cueclub Posted May 14, 2010 Share Posted May 14, 2010 ok what I am wanting to do is, Have a Combo with lets say 6 choices. And after one of them is selected it would be written to an ini file. After start is pressed, it would send it to a function with 6 different options. And where it would start would depend on the choice in the Combo box. So it would run that one, go on to the next to the end then repeat that function. I am having a hard time figuring out how to keep it from calling from the ini after the 1st run is done. Here's my example expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) start() Func start() Local $hcombo, $hGUI, $hButton, $hcombo2, $hLabel2 $hGUI = GUICreate("test - Start from", 340, 115, 10, 100, 1, $WS_EX_TOPMOST) $hLabel2 = GUICtrlCreateLabel(" Please choose where you want to start.", 10, 10, 330, 20) GUICtrlSetFont($hLabel2, Default, 600) $hcombo = GUICtrlCreateCombo("1", 10, 30, 50, 25) GUICtrlSetData(-1, "2|3|4|5|6") $hButton = GUICtrlCreateButton("Start", 115, 60, 100, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton IniWrite(@ScriptDir & "\settings.ini", "start from", "start", GUICtrlRead($hcombo)) GUIDelete() gotofunc() EndSwitch WEnd EndFunc So that would allow me to select where to start from. And then go into the func gotofunc() local $iniread $iniread = iniread((@ScriptDir & "\settings.ini", "start from", "start", "") while 1 if $iniread = 1 then do option 1 end if if $iniread = 2 then option2 endif ect ect... wend endfunc But as you can see I want it to loop all the actions and only start at 1 spot. I hope this makes sense and appreciate any feed back on this. Thanks Cue Link to comment Share on other sites More sharing options...
zorphnog Posted May 14, 2010 Share Posted May 14, 2010 Why exactly do you need to save the setting? If you just want to be able to do a set of actions based on the value of the combo box, something like this would be better: Func start() Local $hcombo, $hGUI, $hButton, $hcombo2, $hLabel2, $iStart $hGUI = GUICreate("test - Start from", 340, 115, 10, 100, 1, $WS_EX_TOPMOST) $hLabel2 = GUICtrlCreateLabel(" Please choose where you want to start.", 10, 10, 330, 20) GUICtrlSetFont($hLabel2, Default, 600) $hcombo = GUICtrlCreateCombo("1", 10, 30, 50, 25) GUICtrlSetData(-1, "2|3|4|5|6") $hButton = GUICtrlCreateButton("Start", 115, 60, 100, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $iStart = GUICtrlRead($hcombo) IniWrite(@ScriptDir & "\settings.ini", "start from", "start", $iStart) Switch $iStart Case 1 ; option 1 Case 2 ; option 2 EndSwitch GUIDelete() ExitLoop EndSwitch WEnd EndFunc Link to comment Share on other sites More sharing options...
l3ill Posted May 14, 2010 Share Posted May 14, 2010 (edited) If your not going to reuse the information in the *.ini why not just use a variable? and then put your goto func loop inside the $hbutton case. Edit: yeah thats what I meant... | Note to self: refresh before posting. Edited May 14, 2010 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
cueclub Posted May 15, 2010 Author Share Posted May 15, 2010 what im worried about is it not looping once it is has completed the 1st option. Is there a way to do it like this: local $hGUI, $hButton, $hcombo, $hLabel2, $istart $hGUI = GUICreate("Test - Start Test", 340, 115, 10, 100, 1, $WS_EX_TOPMOST) $hLabel2 = GUICtrlCreateLabel(" Please choose which where you want to start.", 10, 10, 330, 20) GUICtrlSetFont($hLabel2, Default, 600) $hcombo = GUICtrlCreateCombo("1", 10, 30, 50, 25) GUICtrlSetData(-1, "2|3|4|5|6") $hButton = GUICtrlCreateButton("Start", 115, 60, 100, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $iStart = GUICtrlRead($hcombo) GUIDelete() EndSwitch wend if $istart = 1 Then msgbox(0, "#1", "1") EndIf Im just playing around with it now to try ang get it to work the way I am wanting. The goal is to take the $istart and insert it at different points of a function. so it would have everything above and all I would add is if $istart = 1 then and then send it to part of the function. then it would loop the entire function starting where i decide. hope its not too confusing. Think i might have just confused myself Link to comment Share on other sites More sharing options...
l3ill Posted May 15, 2010 Share Posted May 15, 2010 Just playing around...maybe this is sort of what your looking for: expandcollapse popupLocal $hGUI, $hButton, $hcombo, $hLabel2, $istart $hGUI = GUICreate("Test - Start Test", 340, 115, 10, 100, 1, $WS_EX_TOPMOST) $hLabel2 = GUICtrlCreateLabel(" Please choose which where you want to start.", 10, 10, 330, 20) GUICtrlSetFont($hLabel2, Default, 600) $hcombo = GUICtrlCreateCombo("1", 10, 30, 50, 25) GUICtrlSetData(-1, "2|3|4|5|6") $hButton = GUICtrlCreateButton("Start", 115, 60, 100, 20) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $hButton $istart = GUICtrlRead($hcombo) GUIDelete() EndSwitch If $istart = 1 Then For $istart = 1 To 6 MsgBox(0, "Count", $istart) Next EndIf If $istart = 2 Then For $istart = 2 To 7 MsgBox(0, "Count", $istart) Next EndIf If $istart = 3 Then For $istart = 3 To 8 MsgBox(0, "Count", $istart) Next EndIf If $istart = 4 Then For $istart = 4 To 9 MsgBox(0, "Count", $istart) Next EndIf ;======>and so on WEnd I'm sure theres a way to loop this but ut's getting late My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example 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