XiaolinDraconis Posted June 2, 2014 Posted June 2, 2014 (edited) Thanks for getting the function working guys, now I'm trying to figure out why the tray exit function isn't working. HotKeySet ("-", "test") Opt("TrayOnEventMode", 1) Opt("TrayAutoPause", 0) Opt("TrayMenuMode", 3) TrayCreateItem("Exit") TrayItemSetOnEvent("Exit","quit") $var=IniRead("au3script.ini", "Variables", "var1", "error") While 1 Sleep(100) WEnd Func test() Switch $var Case $var=1 $var+=1 ToolTip("1") Case $var=2 $var+=1 ToolTip("2") Case $var=3 $var=1 ToolTip("3") Case $var>3 ToolTip("error") EndSwitch EndFunc Func quit() IniWrite("au3script.ini", "Variables", "var1", $var) Exit EndFunc Edited June 2, 2014 by XiaolinDraconis
AntiFros Posted June 2, 2014 Posted June 2, 2014 I guess you have to put it into loop. Case are checked once. It dont loop for more checks
AntiFros Posted June 2, 2014 Posted June 2, 2014 Oh, didnt saw that func are reapeated with hotkeys. $var += 1 That should work now
mikell Posted June 2, 2014 Posted June 2, 2014 I forgot to mention the syntax error in the Switch This does work HotKeySet ("a", "test") HotKeySet ("{ESC}", "quit") $var=IniRead("au3script.ini", "Variables", "var1", "error") While 1 Sleep(100) WEnd Func test() Select Case $var=1 $var+=1 ToolTip("1") Case $var=2 $var+=1 ToolTip("2") Case $var=3 $var=1 ToolTip("3") Case $var>3 ToolTip("error") EndSelect EndFunc Func quit() IniWrite("au3script.ini", "Variables", "var1", $var) Exit EndFunc
XiaolinDraconis Posted June 2, 2014 Author Posted June 2, 2014 Thanks guys. Anyone know why my tray function isn't working?
mikell Posted June 2, 2014 Posted June 2, 2014 (edited) Look at my previous post Edit I definitely need a beer $item = TrayCreateItem("Exit") TrayItemSetOnEvent($item,"quit") Edited June 2, 2014 by mikell
XiaolinDraconis Posted June 2, 2014 Author Posted June 2, 2014 I forgot to mention the syntax error in the Switch This does work HotKeySet ("a", "test") HotKeySet ("{ESC}", "quit") $var=IniRead("au3script.ini", "Variables", "var1", "error") While 1 Sleep(100) WEnd Func test() Select Case $var=1 $var+=1 ToolTip("1") Case $var=2 $var+=1 ToolTip("2") Case $var=3 $var=1 ToolTip("3") Case $var>3 ToolTip("error") EndSelect EndFunc Func quit() IniWrite("au3script.ini", "Variables", "var1", $var) Exit EndFunc Seems that switch is meant for more a advanced task?
XiaolinDraconis Posted June 2, 2014 Author Posted June 2, 2014 (edited) Look at my previous post Edit I definitely need a beer $item = TrayCreateItem("Exit") TrayItemSetOnEvent($item,"quit") I am, you changed the tray function to a normal function. I'm trying to make it save when I click exit. Didn't catch the edit, I see what you did, I think. It works, that's what matters. Now I need to read some and figure out why it works. Edited June 2, 2014 by XiaolinDraconis
Solution mikell Posted June 2, 2014 Solution Posted June 2, 2014 The syntax problem was : Switch <expression> Case <value> statement Select Case <expression> statement The tray works in this one, the tray click saves and exits HotKeySet ("a", "test") Opt("TrayMenuMode", 3) Opt("TrayOnEventMode", 1) $item = TrayCreateItem("Exit") TrayItemSetOnEvent($item,"quit") $var=IniRead("au3script.ini", "Variables", "var1", "error") While 1 Sleep(100) WEnd Func test() Select Case $var=1 $var+=1 ToolTip("1") Case $var=2 $var+=1 ToolTip("2") Case $var=3 $var=1 ToolTip("3") Case $var>3 ToolTip("error") EndSelect EndFunc Func quit() IniWrite("au3script.ini", "Variables", "var1", $var) Exit EndFunc
XiaolinDraconis Posted June 2, 2014 Author Posted June 2, 2014 I don't see a switch syntax problem. What I see is you changed it from a switch to a select. Seems not the same to me. But again, it works and that's the focus, thank you for the help.
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