doug4117 Posted March 10, 2006 Share Posted March 10, 2006 I have an extremely simple program...it consists of a while/wend loop containing a Sleep statement. I have defined three Hot Key functions that I want to invoke at my leisure, one of which exits the script. The problem is that once I press one of the Hot Keys, the script invokes the Hot Key function repeatedly. I of course want the function to execute only once and then wait until I press the Hot Key again. Can someone clarify what's going on? Thanks, Doug Link to comment Share on other sites More sharing options...
Valuater Posted March 10, 2006 Share Posted March 10, 2006 (edited) Welcome to Autoit ; Press Esc to terminate script, Pause/Break to "pause" Global $Paused HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() MsgBox(4096,"","This is a message.") EndFunc 8) Edited March 10, 2006 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2006 Moderators Share Posted March 10, 2006 I have an extremely simple program...it consists of a while/wend loop containing a Sleep statement. I have defined three Hot Key functions that I want to invoke at my leisure, one of which exits the script. The problem is that once I press one of the Hot Keys, the script invokes the Hot Key function repeatedly. I of course want the function to execute only once and then wait until I press the Hot Key again.Can someone clarify what's going on?Thanks,DougWelcome to the forums...Rule 1: If you want help, post a working example of your problem. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 10, 2006 Developers Share Posted March 10, 2006 I have an extremely simple program...it consists of a while/wend loop containing a Sleep statement. I have defined three Hot Key functions that I want to invoke at my leisure, one of which exits the script. The problem is that once I press one of the Hot Keys, the script invokes the Hot Key function repeatedly. I of course want the function to execute only once and then wait until I press the Hot Key again.Can someone clarify what's going on?Thanks,Dougand you now want us to guess what could be going on or you can show the portion of the script which has this issue ? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
doug4117 Posted March 10, 2006 Author Share Posted March 10, 2006 Thanks for the welcome, glad to be here. I didn't post any code because, as I said, the program is extremely simple. However, below is the heart of the problem, I think. HotKeySet("{F4}", "Start") HotKeySet("5{APPSKEY}", "Restart") The problem lies in the use of the APPSKEY+number key combination. If I use a function key instead, the function executes only once. In fact, as coded above, the function linked to by the APPSKEY hot key will execute automatically and repeatedly after the completion of the function linked to by the F4 function key. --Doug Link to comment Share on other sites More sharing options...
Valuater Posted March 10, 2006 Share Posted March 10, 2006 you could look at the post i gave you above... or post your full script so that we can get the same reaction as you are getting... to find an answer 8) Link to comment Share on other sites More sharing options...
doug4117 Posted March 10, 2006 Author Share Posted March 10, 2006 Here is the full code...it works great when I use function keys as the hotkeys. When I use the APPSKEYs (currently commented out) as hotkeys it malfunctions. --Doug expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) ; Press Esc to terminate script HotKeySet("{ESC}", "Terminate") ;HotKeySet("4{APPSKEY}", "Start") ;HotKeySet("5{APPSKEY}", "Restart") HotKeySet("{F2}", "Start") HotKeySet("{F4}", "Restart") $X = 0 $Y = 0 While 1 Sleep(1000) WEnd Func Start() $X = 439 $Y = 328 Login() EndFunc Func Restart() $X = 333 $Y = 386 Login() EndFunc Func Login() WinActivate("Login - Microsoft Internet Explorer", "") MouseMove($X,$Y) MouseDown("left") MouseUp("left") Sleep(10) Send("111") Send("{CAPSLOCK}{TAB}{CAPSLOCK}") Send("111") Send("{TAB}{ENTER}") EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted March 10, 2006 Share Posted March 10, 2006 well... it works with the function keys... use them 8) 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