BananaFredSoft Posted July 11, 2007 Share Posted July 11, 2007 (edited) Here is a database program that I made. Enjoy! I'm not sure how to get it so that it displays more than three search results. expandcollapse popup#include <GUIConstants.au3> #include <Array.au3> #include <Misc.au3> Global $inpName Global $inpTags Global $edtDescription Global $NewEntry Global $EditEntry Global $searchnum Global $Dnum Global $case Global $foundnum Global $searchy Global $endnum Global $Tnum Global $dnumber Global $ListView1 Global $Button1 Global $Button2 Global $Button3 Global $num Global $number1 = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1) $ar = _ArrayCreate("") Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("BananaDB", 440, 202, 227, 164) GUISetOnEvent($GUI_EVENT_CLOSE, "EXScript", $Form1) $ListView1 = GUICtrlCreateListView("Name ", 8, 32, 209, 161) $index = GUICtrlCreateInput("", 8, 8, 209, 21) $number = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1) Do _ArrayAdd($ar, "") $number = $number - 1 Until $number = 0 $number = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1) Do If IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number, "Name", "") <> "" Then $ar[$number] = GUICtrlCreateListViewItem(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number, "Name", ""), $ListView1) EndIf $number = $number - 1 Until $number = 0 $number = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1) $Group1 = GUICtrlCreateGroup("Search", 224, 8, 209, 89) Global $inpSearch = GUICtrlCreateInput("", 232, 24, 169, 21) Global $btnGo = GUICtrlCreateButton("Go", 400, 24, 25, 21, 0) GUICtrlSetOnEvent($btnGo, "SearchResults") Global $chkDescription = GUICtrlCreateCheckbox("Description", 232, 48, 73, 17) Global $chkTags = GUICtrlCreateCheckbox("Tags", 312, 48, 49, 17) Global $chkName = GUICtrlCreateCheckbox("Name", 368, 48, 49, 17) Global $chkCase = GUICtrlCreateCheckbox("Case Sensetive", 232, 72, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $btnView = GUICtrlCreateButton("View", 224, 104, 209, 25, 0) GUICtrlSetOnEvent($btnView, "GetDisplay") $btnEdit = GUICtrlCreateButton("Edit", 224, 136, 209, 25, 0) GUICtrlSetOnEvent($btnEdit, "EditEntry") $btnNew = GUICtrlCreateButton("New", 224, 168, 209, 25, 0) GUICtrlSetOnEvent($btnNew, "NewEntry") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $indexn = 0 While 1 $indexn = 0 Do If StringLeft(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $indexn, "Name", ""), StringLen(GUICtrlRead($index))) = GUICtrlRead($index) Then If IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $indexn, "Name", "") <> "" Then GUICtrlSetState($ar[$indexn], $GUI_FOCUS) ExitLoop ;Else itn ; MsgBox(0, "Error", "There was an error.") EndIf EndIf $indexn = $indexn + 1 Until $indexn = $number1 WEnd Func EditEntry () $sfor = GUICtrlRead($ListView1) $num = _ArraySearch($ar, $sfor) #Region ### START Koda GUI section ### Form=f:\applications\koda formdesigner\forms\editnewdbentry.kxf Global $EditEntry = GUICreate("Edit Entry", 439, 255, 216, 120) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIRemove", $EditEntry) Global $edtDescription = GUICtrlCreateEdit("", 8, 96, 425, 121) GUICtrlSetData(-1, StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Description", ""), "\n", @CRLF)) $Label1 = GUICtrlCreateLabel("Description:", 8, 72, 60, 17) $Label2 = GUICtrlCreateLabel("Name:", 8, 8, 35, 17) Global $inpName = GUICtrlCreateInput(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Name", ""), 48, 8, 385, 21) $Label3 = GUICtrlCreateLabel("Tags:", 16, 40, 31, 17) Global $inpTags = GUICtrlCreateInput(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Tags", ""), 48, 40, 385, 21) $Button1 = GUICtrlCreateButton("Apply", 8, 224, 137, 25, 0) GUICtrlSetOnEvent($Button1, "SaveChanges") $Button2 = GUICtrlCreateButton("Cancel", 288, 224, 145, 25, 0) GUICtrlSetOnEvent($Button2, "GUIRemove") $Button3 = GUICtrlCreateButton("Delete", 152, 224, 129, 25, 0) GUICtrlSetOnEvent($Button3, "DeleteEntry") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func NewEntry () #Region ### START Koda GUI section ### Form=f:\applications\koda formdesigner\forms\editnewdbentry.kxf Global $NewEntry = GUICreate("AForm2", 439, 255, 216, 120) GUISetOnEvent($NewEntry, "GUIRemove") Global $edtDescription = GUICtrlCreateEdit("", 8, 96, 425, 121) GUICtrlSetData(-1, "") $Label1 = GUICtrlCreateLabel("Description:", 8, 72, 60, 17) $Label2 = GUICtrlCreateLabel("Name:", 8, 8, 35, 17) Global $inpName = GUICtrlCreateInput("", 48, 8, 385, 21) $Label3 = GUICtrlCreateLabel("Tags:", 16, 40, 31, 17) Global $inpTags = GUICtrlCreateInput("", 48, 40, 385, 21) $Button1 = GUICtrlCreateButton("Create", 8, 224, 137, 25, 0) GUICtrlSetOnEvent($Button1, "SaveNew") $Button2 = GUICtrlCreateButton("Cancel", 288, 224, 145, 25, 0) GUICtrlSetOnEvent($Button2, "GUIRemove") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func SaveNew () $sfor = GUICtrlRead($ListView1) $num = _ArraySearch($ar, $sfor) IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number + 1, "Name", GUICtrlRead($inpName)) IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number + 1, "Tags", GUICtrlRead($inpTags)) IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number + 1, "Description", StringReplace(GUICtrlRead($edtDescription), @CRLF, "\n")) $number = $number + 1 IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", $number) _ArrayAdd($ar, GUICtrlCreateListViewItem(GUICtrlRead($inpName), $ListView1)) GUIDelete($NewEntry) EndFunc Func SaveChanges () $sfor = GUICtrlRead($ListView1) $num = _ArraySearch($ar, $sfor) IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Name", GUICtrlRead($inpName)) IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Tags", GUICtrlRead($inpTags)) IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Description", StringReplace(GUICtrlRead($edtDescription), @CRLF, "\n")) GUIDelete($EditEntry) EndFunc Func GUIRemove () GUIDelete(@GUI_WinHandle) EndFunc Func EXScript () Exit EndFunc Func SearchResults () Global $num = 0 Global $searchy = _ArrayCreate("", "", "", "") Global $searchnum = _ArrayCreate("", "", "", "") If GUICtrlRead($chkCase) = $GUI_CHECKED Then Global $case = 1 Else Global $case = 0 EndIf Global $number = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1) Global $Dsearchedfor = 1 Global $Nsearchedfor = 1 Global $Tsearchedfor = 1 Global $foundnum = 0 Global $Dnum = 0 Global $Tnum = 0 Global $Nnum = 0 $searchtimes = 0 Do If GUICtrlRead($chkName) = $GUI_CHECKED Then Call("SearchName") If GUICtrlRead($chkTags) = $GUI_CHECKED Then Call("SearchTags") If GUICtrlRead($chkDescription) = $GUI_CHECKED Then Call("SearchDescription") $searchtimes = $searchtimes + 1 Until BitOR($foundnum > 2, $searchtimes > 3) #Region ### START Koda GUI section ### Form= $Form3 = GUICreate("Search BananaDB", 416, 282, 235, 115) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIRemove", $Form3) $srchresults = GUICtrlCreateGroup("Search Results", 8, 8, 401, 265) $Label1 = GUICtrlCreateLabel($searchy[1], 16, 32, 387, 60) $Label2 = GUICtrlCreateLabel($searchy[2], 16, 112, 379, 60) $Label4 = GUICtrlCreateLabel($searchy[3], 16, 192, 387, 60) Global $Button1 = GUICtrlCreateButton("View", 16, 88, 97, 17, 0) GUICtrlSetOnEvent($Button1, "GetDisplay") Global $Button2 = GUICtrlCreateButton("View", 16, 168, 89, 17, 0) GUICtrlSetOnEvent($Button2, "GetDisplay") Global $Button3 = GUICtrlCreateButton("View", 16, 248, 89, 17, 0) GUICtrlSetOnEvent($Button3, "GetDisplay") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func GetDisplay () If @GUI_CtrlId = $Button1 Then $dnumber = $searchnum[1] ElseIf @GUI_CtrlId = $Button2 Then $dnumber = $searchnum[2] ElseIf @GUI_CtrlId = $Button3 Then $dnumber = $searchnum[3] Else $thing = GUICtrlRead($ListView1) $dnumber = _ArraySearch($ar, $thing) EndIf Call("Display") EndFunc Func Display () #Region ### START Koda GUI section ### Form=f:\applications\koda formdesigner\forms\viewdbentry.kxf $Form1_1 = GUICreate("Display Entry", 439, 225, 271, 195) GUISetOnEvent($GUI_EVENT_CLOSE, "GUIRemove", $Form1_1) $Label2 = GUICtrlCreateLabel("Name: " & IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $dnumber, "Name", ""), 8, 8, StringLen(iniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $dnumber, "Name", "")) * 12, 17) GUICtrlSetBkColor($Label2, 0xFFFFFF) $Label3 = GUICtrlCreateLabel("Tags: " & IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $dnumber, "Tags", ""), 8, 40, StringLen(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $dnumber, "Tags", "")) * 12, 17) GUICtrlSetBkColor($Label3, 0xFFFFFF) $Label1 = GUICtrlCreateLabel("Description: " & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $dnumber, "Description", ""), "\n", @CRLF), 8, 72, 400, 140) GUICtrlSetBkColor($Label1, 0xFFFFFF) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### EndFunc Func SearchDescription () Do $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum, "Description", ""), GUICtrlRead($inpSearch), $case) $Dnum = $Dnum + 1 Until BitOR($Dnum > IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1), $search <> 0) If $search <> 0 Then $foundnum = $foundnum + 1 $searchy[$foundnum] = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum - 1, "Description", "") & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum - 1, "Description", ""), "\n", @CRLF) If $searchy[$foundnum - 1] = $searchy[$foundnum] Then $foundnum = $foundnum - 1 $searchnum[$foundnum] = $Dnum - 1 Else Return 0 EndIf EndFunc Func SearchName () Do $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Nnum, "Name", ""), GUICtrlRead($inpSearch), $case) $Nnum = $Nnum + 1 Until BitOR($Nnum > IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1), $search <> 0) If $search <> 0 Then $foundnum = $foundnum + 1 $searchy[$foundnum] = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Nnum - 1, "Name", "") & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Nnum - 1, "Description", ""), "\n", @CRLF) If $searchy[$foundnum - 1] = $searchy[$foundnum] Then $foundnum = $foundnum - 1 $searchnum[$foundnum] = $Nnum - 1 Else Return 0 EndIf EndFunc Func SearchTags () Do $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Tnum, "Tags", ""), GUICtrlRead($inpSearch), $case) $Tnum = $Tnum + 1 Until BitOR($Tnum > IniRead(@ScriptDir & "\BananaDataBaseData.data", "Main", "Number", 1), $search <> 0) If $search <> 0 Then $foundnum = $foundnum + 1 $searchy[$foundnum] = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Tnum - 1, "Name", "") & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Tnum - 1, "Description", ""), "\n", @CRLF) If $searchy[$foundnum - 1] = $searchy[$foundnum] Then $foundnum = $foundnum - 1 $searchnum[$foundnum] = $Tnum - 1 Return $search Else Return 0 EndIf EndFunc Func DeleteEntry () $s = GUICtrlRead($ListView1) GUICtrlDelete($s) $num = _ArraySearch($ar, $s) If MsgBox(4, "Delete Confirmation", "Are you sure that you want to delete the entry called '" & IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Name", "") & "'?") = 6 Then IniDelete(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num) EndIf GUIDelete($EditEntry) EndFunc Edited July 12, 2007 by BananaFredSoft -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
smashly Posted July 11, 2007 Share Posted July 11, 2007 Hi, thank you for sharing your efforts I haven't tried your script yet, but does it support a data base file greater then 32kb (ini limitation) ? It would be nice to see something like your script but using fileread & filewrite instead. Keep up the good work Cheers Link to comment Share on other sites More sharing options...
BananaFredSoft Posted July 11, 2007 Author Share Posted July 11, 2007 Ini's are limited to 32kb? I didn't know that. Ouch. That's a limitation. It only uses one ini, so it doesn't break the limitation.I think that SQLite would be easier and faster than filewrite/read, right?Hi, thank you for sharing your efforts I haven't tried your script yet, but does it support a data base file greater then 32kb (ini limitation) ?It would be nice to see something like your script but using fileread & filewrite instead.Keep up the good work Cheers -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
BananaFredSoft Posted July 12, 2007 Author Share Posted July 12, 2007 (edited) Could someone tell me why this isn't getting any replies? Is it really bad or annoying? Edited July 12, 2007 by BananaFredSoft -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 12, 2007 Moderators Share Posted July 12, 2007 One thing you might want to do ... is make sure you comment what is needed to make the script run.expandcollapse popupC:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(110,107) : WARNING: $inpName: possibly used before declaration. IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number + 1, "Name", GUICtrlRead($inpName) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(111,107) : WARNING: $inpTags: possibly used before declaration. IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number + 1, "Tags", GUICtrlRead($inpTags) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(112,135) : WARNING: $edtDescription: possibly used before declaration. IniWrite(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $number + 1, "Description", StringReplace(GUICtrlRead($edtDescription) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(116,24) : WARNING: $NewEntry: possibly used before declaration. GUIDelete($NewEntry) ~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(125,25) : WARNING: $EditEntry: possibly used before declaration. GUIDelete($EditEntry) ~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(179,33) : WARNING: $searchnum: possibly used before declaration. $dnumber = $searchnum[1] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(205,100) : WARNING: $Dnum: possibly used before declaration. $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(205,152) : WARNING: $case: possibly used before declaration. $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum, "Description", ""), GUICtrlRead($inpSearch), $case) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(209,35) : WARNING: $foundnum: possibly used before declaration. $foundnum = $foundnum + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(210,252) : WARNING: $searchy possibly not declared/created yet $searchy[$foundnum] = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum - 1, "Description", "") & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Dnum - 1, "Description", ""), "\n", @CRLF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(219,100) : WARNING: $Nnum: possibly used before declaration. $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Nnum, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(224,245) : WARNING: $searchy possibly not declared/created yet $searchy[$foundnum] = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Nnum - 1, "Name", "") & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Nnum - 1, "Description", ""), "\n", @CRLF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(233,100) : WARNING: $Tnum: possibly used before declaration. $search = StringInStr(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Tnum, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(238,245) : WARNING: $searchy possibly not declared/created yet $searchy[$foundnum] = IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Tnum - 1, "Name", "") & @CRLF & StringReplace(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $Tnum - 1, "Description", ""), "\n", @CRLF) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3(75,136) : WARNING: $inpName: declared global in function only. Prefer top of file. Global $inpName = GUICtrlCreateInput(IniRead(@ScriptDir & "\BananaDataBaseData.data", "Entry " & $num, "Name", ""), 48, 8, 385, 21) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\AutoIts.Forum.Examples\SomeRandomUser\Desktop\TestAu3Scripts.au3 - 0 error(s), 15 warning(s) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options... BananaFredSoft Posted July 12, 2007 BananaFredSoft Active Members 462 You will contradict this statement Author Share Posted July 12, 2007 Do you mean like Includes?The includes are GUIConstants.au3, Array.au3 and Misc.au3One thing you might want to do ... is make sure you comment what is needed to make the script run.I personally don't feel like debugging it to find out myself.... -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options... Moderators SmOke_N Posted July 12, 2007 SmOke_N Moderators 16.3k 49 It's not what you know ... It's what you can prove! Moderators Share Posted July 12, 2007 Do you mean like Includes?The includes are GUIConstants.au3, Array.au3 and Misc.au3No... I mean "like" read my errors I posted for you Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options... BananaFredSoft Posted July 12, 2007 BananaFredSoft Active Members 462 You will contradict this statement Author Share Posted July 12, 2007 (edited) I have used it quite a bit and no errors show up.No... I mean "like" read my errors I posted for you Edited July 12, 2007 by BananaFredSoft -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options... Generator Posted July 12, 2007 Generator Active Members 1.5k Code Generator Share Posted July 12, 2007 I have used it quite a bit and no errors show up.Maybe you should include the ini file too, i got the same error and no results for searching. Link to comment Share on other sites More sharing options... Gif Posted July 12, 2007 Gif Active Members 1.1k Laikon Kafekoption Share Posted July 12, 2007 Ini's are limited to 32kb? I didn't know that. Ouch. That's a limitation. It only uses one ini, so it doesn't break the limitation.Smoke_N wrote a script to bypass the 32kb limit, you ll find it here Link to comment Share on other sites More sharing options... BananaFredSoft Posted July 12, 2007 BananaFredSoft Active Members 462 You will contradict this statement Author Share Posted July 12, 2007 You don't need the ini to start out. You won't get any results for searching until you've created entries that have the keywords you are searching for in them Maybe you should include the ini file too, i got the same error and no results for searching. -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options... Moderators SmOke_N Posted July 12, 2007 SmOke_N Moderators 16.3k 49 It's not what you know ... It's what you can prove! Moderators Share Posted July 12, 2007 I have used it quite a bit and no errors show up.Well, did you do an Au3Check on it? I didn't make up the above errors, so they are real regardless of whether you have gotten them or not.Quickly looking over them, it's easy to manage... just take the time to do so ... anyway they are all "variables" used before being declared errors I believe... a very easy fix if you just Global them at the top of your script, in fact, my error log output from Au3Check shown you, tells you the variable and the line number to make it easy on you. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options... BananaFredSoft Posted July 12, 2007 BananaFredSoft Active Members 462 You will contradict this statement Author Share Posted July 12, 2007 All fixed. Thanks for the help, SmOke_N.Anyone have any comments/suggestions?Well, did you do an Au3Check on it? I didn't make up the above errors, so they are real regardless of whether you have gotten them or not.Quickly looking over them, it's easy to manage... just take the time to do so ... anyway they are all "variables" used before being declared errors I believe... a very easy fix if you just Global them at the top of your script, in fact, my error log output from Au3Check shown you, tells you the variable and the line number to make it easy on you. -ColinSite:www.bananafredsoft.comStuff:Simple Text Editor - MediaPlayer - Animator - BananaDB - BananaNotes - Chatta - Filesearch - Excuse GeneratorMy YouTube channel:http://www.youtube.com/user/colipat Link to comment Share on other sites More sharing options... GEOSoft Posted July 13, 2007 GEOSoft MVPs 10.3k Sure I'm senile. What's your excuse? Share Posted July 13, 2007 One thing you might want to do ... is make sure you comment what is needed to make the script run.I personally don't feel like debugging it to find out myself.... All I see are Warnings, all of which mean absolutely nothing. What am I missing? There are no errors and the "Possibly used before declaration" is a warning that should be totally ignored at all times as far as I'm concerned. I use AU3check with Project Express but I have an option to ignore warnings strictly because of that one.The "$inpName: declared global in function only. Prefer top of file." is being generated because the GUI is in a function and again means nothing. I think these warnings are generated because of the order in which the checking is done. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options... Moderators SmOke_N Posted July 13, 2007 SmOke_N Moderators 16.3k 49 It's not what you know ... It's what you can prove! Moderators Share Posted July 13, 2007 All I see are Warnings, all of which mean absolutely nothing. What am I missing? There are no errors and the "Possibly used before declaration" is a warning that should be totally ignored at all times as far as I'm concerned. I use AU3check with Project Express but I have an option to ignore warnings strictly because of that one.The "$inpName: declared global in function only. Prefer top of file." is being generated because the GUI is in a function and again means nothing. I think these warnings are generated because of the order in which the checking is done.I posted "error" because there were 15 listed "warnings" and I wasn't going to go through them to see if there were actual errors or just warnings (as I stated in the post you quoted).You may choose to ignore them, but a warning is basically telling you to start coding structurally correct. That may mean absolutely nothing to you, but when you start coding sloppy, it will inevitably end up in actual errors anyway. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options... GEOSoft Posted July 14, 2007 GEOSoft MVPs 10.3k Sure I'm senile. What's your excuse? Share Posted July 14, 2007 I posted "error" because there were 15 listed "warnings" and I wasn't going to go through them to see if there were actual errors or just warnings (as I stated in the post you quoted).You may choose to ignore them, but a warning is basically telling you to start coding structurally correct. That may mean absolutely nothing to you, but when you start coding sloppy, it will inevitably end up in actual errors anyway.In my way of thinking "Possibly used before declaration" does not indicate sloppy coding in any manner whatsoever and in most cases it's caused by a prefered coding style, and the error can be avoided by several methods. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options... Moderators SmOke_N Posted July 14, 2007 SmOke_N Moderators 16.3k 49 It's not what you know ... It's what you can prove! Moderators Share Posted July 14, 2007 In my way of thinking "Possibly used before declaration" does not indicate sloppy coding in any manner whatsoever and in most cases it's caused by a prefered coding style, and the error can be avoided by several methods.It's obvious we both have different opinions on proper code structure. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options... GEOSoft Posted July 14, 2007 GEOSoft MVPs 10.3k Sure I'm senile. What's your excuse? Share Posted July 14, 2007 (edited) It's obvious we both have different opinions on proper code structure.Not unusual with coders You wouldn't want to see the AU3Check report for Project Express if I left Warnings enabled and the warnings simply do not apply. They are caused by the number of child windows being created (currently at 28) most of which will only be created only if and when the user wants to use a particular tool. I find it better to create and delete windows only as required rather than having so many created and then hidden untill they are required. AU3Check actually will show errors where none exist as well although that is rare. Not sure if it still deoes it or not but not all that far back using GUISetState() would cause an error to be reported because the program thinks GUISetState(@SW_SHOW) is better. I disagree. Wherever possible I will use the shorter version and I don't care at all if another app disagrees or not. The same applies to Global constants. Why would I want to use If GUICtrlRead($Ctrl) = $GUI_Checked Thenwhen I can use If GUICtrlRead($Ctrl) = 1 Then Most people don't realize how many unused constants are being added to their code by #including Constants files. At compile time you have just added a tremendous amount of useless code. I've also seen several cases where the name of the variable is longer than the line of code it's used in but the value of the variable is a single digit. I don't believe that not #including constants is bad coding, others will (and have) disagreed. Like I said, personal preferences. That's why I don't enable warnings unless there is a problem that a warning might tip me off to. I do always error check though. Edited July 14, 2007 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
WeMartiansAreFriendly Posted July 14, 2007 Share Posted July 14, 2007 Unless those warnings are easily avoidable, I see no reason in not getting them fixed. Opt('MustDeclarevariables',1) would take the fun out of coding though, bug fixes, debugging eck!!!.. Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now