Jump to content

Recommended Posts

Posted (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 by XiaolinDraconis
Posted

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
Posted

 

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?

Posted (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 by XiaolinDraconis
  • Solution
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...