Mixam Posted April 24, 2008 Share Posted April 24, 2008 I was looking for something like OnAutoItExit() for pause because I wanted to add a timer to tell me how long it was paused for after it is unpaused. If there is something like OnAutoItPause() then just tell me about that and ignore the rest of this. I couldn't find anything like that so I tried removing pause and making my own pause. Its been a disaster, most of what I have tried has just ended up with the script freezing up so I can't exit it without ctrl alt del This is the latest thing I've tried. I took the example code for using pause/break as a pause toggle, and that worked for me, but once I tried using it with the tray instead of hotkeys it stops working. As in nothing in the tray works anymore, not even exit. If i put the while $Paused loop in the main wile loop, it works. But in the program I'm actually using this in there are many loops and I'm not sure which will be running at any given time. And since I want pause to kick in right away, I can't wait for whatever loop is currnently running to finish before the pause kicks in. Please help. expandcollapse popup#Include <Constants.au3> #include <GUIConstants.au3> #NoTrayIcon Opt("TrayAutoPause", 0);dont pause on tray click Opt("TrayMenuMode", 1);hide script pause Opt("GUIOnEventMode", 1); Change to OnEvent mode Opt("TrayOnEventMode", 1); Change to OnEvent mode Global $pausetimer = 0 Global $Paused = False $pauseitem = TrayCreateItem("Pause") TrayItemSetOnEvent(-1,"TogglePause") TrayCreateItem("");Seperator $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"ExitItem") TraySetState() TraySetClick(8);Menu only shows with a right click While 1 Sleep(500) WEnd Func TogglePause() $Paused = NOT $Paused If $Paused = True Then TrayItemSetText ($pauseitem, "Unpause") Else TrayItemSetText ($pauseitem, "Pause") EndIf While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func ExitItem() Exit EndFunc Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 24, 2008 Share Posted April 24, 2008 Hi, have a look at TrayMenuMode with Option 2 and then may go for message loop mode, too. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Mixam Posted April 24, 2008 Author Share Posted April 24, 2008 (edited) have a look at TrayMenuMode with Option 2 and then may go for message loop mode, too.Thanks for the option 2, I had just changed it to use pause/unpause instead of checkmarks. I hadn't gotten around to that yet because the pause itself isn't working, so I hadn't bothered with the checkmarks. I had originally been detecting if it was checked or not to turn the pause on but that was a huge failure too, so I'm trying this.As for the message loop, if you mean where it does case 1 case2 blah... loop for what you pressed, I do not think that will work for me. Unless there is a way to run multiple loops at the same time, as I can't have it sitting there waiting for user input from the tray while it is supposed to be doing other things.Edit: tried option 2, but that made the default pause and exit come back. On that note, when i used my pause then, my exit didn't work, but the default exit and pause still worked. Edited April 24, 2008 by Mixam Link to comment Share on other sites More sharing options...
Xenobiologist Posted April 24, 2008 Share Posted April 24, 2008 Hi, in Message Loop Mode your tasks will be possible, too. Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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