Rickbert Posted May 4, 2007 Share Posted May 4, 2007 I wrote a script, which checks a database every x seconds, and pops up a message if new records are added to that database. I then added a tray menu to allow for quick access to some related web pages. I then noticed that the script stopped working correctly. The script below behaves similarly, the splash screen should appear for 2 seconds every 10 seconds that the script is run. However, the script seems to hang on the TrayGetMsg call. Interestingly, if you run the mouse cursor over the tray icon, the splash screen appears, and then goes away, as it should. Any ideas, or help would be appreciated. expandcollapse popup; ;=============================================================================== ; #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $settingsitem = TrayCreateMenu("Settings") $displayitem = TrayCreateItem("Display", $settingsitem) $printeritem = TrayCreateItem("Printer", $settingsitem) TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() $timer = TimerInit() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem Msgbox(64,"about:","AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop EndSelect $timerdiff = TimerDiff($timer) If $timerdiff > 10000 Then SplashTextOn("Splash","More than 10 seconds have passed") Sleep(2000) $timer = TimerInit() SplashOff() EndIf WEnd Exit Link to comment Share on other sites More sharing options...
MHz Posted May 4, 2007 Share Posted May 4, 2007 Case $msg = 0 ContinueLoopReturn Value Returns an event. The "event" returned is the control ID of the control sending the message, or it is a special event (like the mouse clicking on the tray icon). Or if there is no message, the event is 0.Somewhat hard to get past that Continueloop unless some non 0 event happens as you are blocking 0 getting through the loop. Link to comment Share on other sites More sharing options...
Rickbert Posted May 4, 2007 Author Share Posted May 4, 2007 Somewhat hard to get past that Continueloop unless some non 0 event happens as you are blocking 0 getting through the loop.You're absolutely right... have to be more carful about copy/pasting from the help file Thanks!! Link to comment Share on other sites More sharing options...
Teldin Posted May 4, 2007 Share Posted May 4, 2007 (edited) By the way, you can put the timerdiff check into a Case: $timerdiff = TimerDiff($timer) While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $aboutitem Msgbox(64,"about:","AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop Case $timerdiff > 10000 SplashTextOn("Splash","More than 10 seconds have passed") Sleep(2000) $timer = TimerInit() SplashOff() EndSelect WEnd Edited May 4, 2007 by Teldin Link to comment Share on other sites More sharing options...
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