Jump to content

Help With Traymenu While Statement


Recommended Posts

Hi all.....

First post here....

I am having some problems getting my Traymenu to work at the same time as running another function. Basically I want the app to load up the Traymenu and then proceed into my function called "NagBox". I can right click on the Traymenu and get all of the options but no commands work from there while "NagBox" is running. Here is the code:

Func TrayMenu()

Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

$settingsoption = TrayCreateMenu("Options")

$configoption = TrayCreateItem("Configure", $settingsoption)

$runoption = TrayCreateItem("Run Now", $settingsoption)

TrayCreateItem("")

$aboutitem = TrayCreateItem("About")

TrayCreateItem("")

$exititem = TrayCreateItem("Exit")

TraySetState()

While 1

$msg = TrayGetMsg()

If $msg = 0 Then

ContinueLoop

EndIf

If $msg = $aboutitem Then

Call ("Splash")

EndIf

If $msg = $exititem Then

ExitLoop

EndIf

If $msg = $configoption Then

Call ("Configure")

EndIf

If $msg = $runoption Then

Call ("Process")

EndIf

Call("NagBox")

WEnd

EndFunc

I have also tried the above with CASE statements and still no go. I hope the above is a clear indication of what I am trying to do. Any help is appreciated....

Thanks,

JP

Link to comment
Share on other sites

AutoIt is not multithreaded, so running two pieces of your script at once is not possible. You never run the NagBox() function because all of the tray options stay within the loop. I would suggest looking at TrayOnEventMode, because that allows you to set events and then go on to other parts of the script while AutoIt waits for tray events in the background.

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...