Gif Posted May 6, 2007 Share Posted May 6, 2007 (edited) Do Functions work when the program sleeps? example : hotkeyset("!^e", "e_qu") While 1 sleep(100000) msgbox(0, "error", "error", 4) Wend Func e_qu() exit EndFunc Will the exit function work while in sleep mode? Edited May 6, 2007 by c4nm7 Link to comment Share on other sites More sharing options...
erebus Posted May 6, 2007 Share Posted May 6, 2007 (edited) I think not. Nothing works when the program sleeps; I think it is the same like pausing the program from its tray menu. Use While Wend loops instead to see if it does the trick: While 1 Wend The idea behind this is that the program actually never sleeps, but it falls into an infinite loop. To see the difference, if you add a sleep delay into that While Wend loop, and you try to press your hotkey, you 'll see that sometimes the hotkey is not working. This happens because your keypress happens by luck when the Sleep() function is being executed. When the Sleep() function ends and only the loop's part is executed, you would be able to press your hotkey and call its function. So the more the Sleep() time you use, the less possibility you have to call your hotkey's function. Edited May 6, 2007 by erebus Link to comment Share on other sites More sharing options...
Gif Posted May 6, 2007 Author Share Posted May 6, 2007 I think not. Nothing works when the program sleeps; I think it is the same like pausing the program from its tray menu.Use While Wend loops instead to see if it does the trick:While 1WendThe idea behind this is that the program actually never sleeps, but it falls into an infinite loop. To see the difference, if you add a sleep delay into that While Wend loop, and you try to press your hotkey, you 'll see that sometimes the hotkey is not working. This happens because your keypress happens by luck when the Sleep() function is being executed. When the Sleep() function ends and only the loop's part is executed, you would be able to press your hotkey and call its function. So the more the Sleep() time you use, the less possibility you have to call your hotkey's function.so how can i execute the same action (i mean the message box every 10000) while the function working? Link to comment Share on other sites More sharing options...
herewasplato Posted May 6, 2007 Share Posted May 6, 2007 ...Nothing works when the program sleeps; I think it is the same like pausing the program from its tray menu...This is not true. Several things work "when the program sleeps" - HotKeys and Adlibs are but two. Run this and let me know if the HotKeys that are set do not work for you 100% of the time.HotKeySet("a", "_on") HotKeySet("s", "_off") While 1 Sleep(2147483647) ;24 days of sleep WEnd Func _on() ToolTip("The tooltip is on.") EndFunc ;==>_on Func _off() ToolTip("") EndFunc ;==>_off [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted May 6, 2007 Share Posted May 6, 2007 (edited) ...Will the exit function work while in sleep mode?Yes, but the sleep mode is not the problem. The function will not work while the MsgBox is awaiting a user's interaction. Edited May 6, 2007 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
herewasplato Posted May 6, 2007 Share Posted May 6, 2007 so how can i execute the same action (i mean the message box every 10000) while the function working?You might take a look at SplashTextOn (). [size="1"][font="Arial"].[u].[/u][/font][/size] 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