Jump to content

Tray Functions


 Share

Recommended Posts

Ive created a script that runs a rather long funtion in it, i wanted to have 2 options in the tray menue, 1 to break out of the loop of the function and another option to restart the function from the begining

the said function runs by default when the script is executed and the menu item i created to break the loop and return to a higher level loop works fine, BUT when i call the said function FROM the tray then no other tray function will work until the originaly called function is complete.

is this just a limit of autoit? or somthing i may be doing wrong?

thanks for any help!

-john

Link to comment
Share on other sites

Hmm, code sample would help... but here is what i would do to achieve the same thing you are trying to do:

Start the function when the script is run

allow stop via a keypress

allow start from a keypress again.

Global $i = 1

HotKeySet ( "r", "_Start" )
HotKeySet ( "s" ,"_Stop" )

While 1
if $i = 1 THEN _MyFunc()
WEnd

Func _MyFunc()
    MsgBox(0, "my func", "MyFunc started")
While $i = 1
Sleep(100)
WEnd
    MsgBox(0, "my func", "MyFunc stopped")
EndFunc

Func _Start()
    MsgBox(0, "start", "start")
$i = 1
EndFunc

Func _Stop()
    MsgBox(0, "stop", "stop")
$i = 2
EndFunc
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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