sensalim Posted August 1, 2008 Share Posted August 1, 2008 I'm sure this has been asked before but I just don't know how to search for it. Ok say I have an ini file that lists like this FileOpen=!fo FilePrint=!fp FilePrintPreview=!fv FilePageSetup=!fu So now a script would load this ini file into an array, say $array1 How do I make a GUI that takes this array and create 4 buttons (or 5 if this array has 5 members)? The button would then be like: GUICtrlCreateButton("FileOpen", ... ) GUICtrlSetOnEvent(-1, ...) GUICtrlCreateButton("FilePrint", ... ) GUICtrlSetOnEvent(-1, ...) which point to a dynamically created functions. For FileOpen, it would be send("!fo"). For FilePrint, it would send("!fp") etc. Does it make sense? Thanks! Link to comment Share on other sites More sharing options...
baghenamoth Posted August 2, 2008 Share Posted August 2, 2008 maybe it can help : #include-once #include <GUIConstants.au3> Opt("GUICoordMode", 2) $array = IniReadSection(@ScriptDir & "\test.ini","TASKS") If @error Then Exit GUICreate("test") Dim $a_Buttons[$array[0][0]] For $i = 1 To $array[0][0] $a_Buttons[$i-1] = GUICtrlCreateButton($array[$i][0],-1,1,100,40) Next GUISetState() While 1 $msg = GUIGetMsg() For $i = 1 To $array[0][0] If $msg = $a_Buttons[$i-1] Then FuncSend($array[$i][1]) Next If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd Func FuncSend($myString) Send($myString) EndFunc Link to comment Share on other sites More sharing options...
sensalim Posted August 4, 2008 Author Share Posted August 4, 2008 Thanks for the help. Learned something about guicoordmode. However, how would this work if I use Opt("GUIOnEventMode", 1) ? 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