scriptomator 0 Posted October 10, 2010 i want the select loop to detect more than one variable with one case . i dont know how to do it. i want the message box to happen only when one of the three buttons is pressed $GUI = GUICreate("The box", 537, 396, -1, -1) $1 = GUICtrlCreateButton("1", 1, 104, 27, 25) $2 = GUICtrlCreateButton("2", 184, 104, 27, 25) $3 = GUICtrlCreateButton("3", 114, 104, 27, 25) GUISetState(@SW_SHOW) Global $1,$2,$3 While 1 $Msg = GUIGetMsg() Select case $Msg = $1 or $2 or $3 MsgBox(0,"","yay it works") exit EndSelect WEnd Share this post Link to post Share on other sites
wakillon 403 Posted October 10, 2010 (edited) Try like this $GUI = GUICreate("The box", 537, 396, -1, -1) $1 = GUICtrlCreateButton("1", 1, 104, 27, 25) $2 = GUICtrlCreateButton("2", 184, 104, 27, 25) $3 = GUICtrlCreateButton("3", 114, 104, 27, 25) GUISetState(@SW_SHOW) Global $1,$2,$3 While 1 $Msg = GUIGetMsg() Switch $Msg case $1 MsgBox(0,"1","yay it works") case $2 MsgBox(0,"2","yay it works") case $3 MsgBox(0,"3","yay it works") EndSwitch WEnd Edited October 10, 2010 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
scriptomator 0 Posted October 10, 2010 I don't want it like that. i have a lot of variables that will require the one function to run. the function will figure out what the variable is that needs changing. but the problem is that i do not wand to type all of that in and i do not want to make the script to large. making the one function run with one line of code but many different things to trigger it is what i want. Share this post Link to post Share on other sites
wakillon 403 Posted October 10, 2010 I don't want it like that. i have a lot of variables that will require the one function to run. the function will figure out what the variable is that needs changing. but the problem is that i do not wand to type all of that in and i do not want to make the script to large. making the one function run with one line of code but many different things to trigger it is what i want. Like this ? $GUI = GUICreate("The box", 537, 396, -1, -1) $1 = GUICtrlCreateButton("1", 1, 104, 27, 25) $2 = GUICtrlCreateButton("2", 184, 104, 27, 25) $3 = GUICtrlCreateButton("3", 114, 104, 27, 25) GUISetState(@SW_SHOW) Global $1,$2,$3 While 1 $Msg = GUIGetMsg() Switch $Msg case $1, $2, $3 MsgBox(0,"","yay it works") EndSwitch WEnd AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
scriptomator 0 Posted October 10, 2010 UGHHH. I am an idiot. i cant believe i did not try that. I something very close to that and it did not work so i moved on to another method. thanks! Share this post Link to post Share on other sites
wakillon 403 Posted October 10, 2010 UGHHH. I am an idiot. i cant believe i did not try that. I something very close to that and it did not work so i moved on to another method. thanks! Glad to help you, and look switch function in helpfile : Switch...Case...EndSwitch Conditionally run statements. Switch <expression> Case <value> [To <value>] [,<value> [To <value>] ...] statement1 ... [Case <value> [To <value>] [,<value> [To <value>] ...] statement2 ...] [Case Else statementN ...] EndSwitch AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Share this post Link to post Share on other sites
scriptomator 0 Posted October 10, 2010 well....time to do some script renovation. it should only take half an hour. Share this post Link to post Share on other sites