sydok Posted April 20, 2004 Share Posted April 20, 2004 I've been using a script with a 80 second pause to give me time to prepare everything before it starts. Well I was wanting to start is paused and allow me to pause the script. After reading the help files and assisant from a friend I used--AdlibEnable("pause"); this keeps running at all times till you exit.HotKeySet("{INSERT}","pauseset"); uses the insert key to change the value of $Pause$Pause = -1--My old code w/o the 80second sleep--Func pauseset() $Pause = $Pause * -1EndFuncFunc pause() While $Pause = -1 Sleep(500) WendEndFuncThat works fine on his, but not mine. I believe the problem is it's not capturing the key. I then tried it with many other keys with no luck. I didn't like having the AdlibEnable running and cleand it up to this (which runs exactly the same under notepad if i put a Send("Text") loop)--HotKeySet("{INSERT}","pauseset"); uses the insert key to change the value of $Pause$Pause = -1pauseset()--My old code w/o the 80second sleep--Func pauseset() $Pause = $Pause * -1 While $Pause = 1 Sleep(100) WendEndFuncThe only difference between our machines is his is a little faster, and he is running Win2k and I'm on XP. I was curious if anyone had a similar problem, or any suggetions to fix it. Thanks in advanced. Link to comment Share on other sites More sharing options...
scriptkitty Posted April 20, 2004 Share Posted April 20, 2004 I like this type setup: Hotkeyset("{pause}","pause") $x=1 while $x=1 sleep(10) wend ; this will not go until $x changes ; blah blah blah a bunch of things you want to do func pause() ; this will toggle to pause and run each time hit. $x=NOT $x while $x=1 Sleep(10) wend endfun AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
Developers Jos Posted April 20, 2004 Developers Share Posted April 20, 2004 (edited) What about this version?? You need to define the HotkeySet before the AdlibEnable or else the AdlibEnable kicks in before the HotKeySet is done.... $Pause = -1 HotKeySet("{INSERT}","pauseset"); uses the insert key to change the value of AdlibEnable("pause"); this keeps running at all times till you exit. sleep(1000) msgbox(0,'test','test') Func pauseset() $Pause = $Pause * -1 EndFunc Func pause() While $Pause = -1 Sleep(500) Wend EndFunc Edited April 20, 2004 by JdeB 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...
sydok Posted April 20, 2004 Author Share Posted April 20, 2004 (edited) Thank you for your replys scriptkitty and JdeB, only problem is it still doesn't work . I tried with {pause}, {insert}, and "+!p". I think my problem is autoit not capturing my keystroke. Has anyone else had a similar problem, or a suggestion to work around it? Edited April 20, 2004 by sydok Link to comment Share on other sites More sharing options...
Developers Jos Posted April 20, 2004 Developers Share Posted April 20, 2004 Try this version to see if it ever gets there: Also made the sleep shorter... $Pause = -1 HotKeySet("{INSERT}","pauseset"); uses the insert key to change the value of AdlibEnable("pause"); this keeps running at all times till you exit. sleep(1000) msgbox(0,'test','test') Func pauseset() msgbox(0,'test','PAUSE pressed') $Pause = $Pause * -1 EndFunc Func pause() While $Pause = -1 Sleep(10) Wend EndFunc 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...
sydok Posted April 20, 2004 Author Share Posted April 20, 2004 They are all working within windows, it's when I run the game it all stops working. I have friends who use the same functions, and I just now sent my friend one that would just type text once Insert was pressed and it worked flawlessly. I can start up the macro with a sleep, and after the sleep is up it will run the loop fine, the only thing is capturing they keys while in game. I wouldn't be bothered by it if it didn't run on everyone elses computer except mine. Link to comment Share on other sites More sharing options...
scriptkitty Posted April 20, 2004 Share Posted April 20, 2004 some games keypresses don't work well. On Win95/98/ME, I had a problem with many DirectX games. You might try some different key combos, say maybe the apps key might work. To see if it actually is grabbing the key press, try this one: Hotkeyset("{pause}","pause") $x=1 while $x=1 sleep(10) wend; this will not go until $x changes while 1 sleep(1000) wend func pause(); this will toggle to pause and run each time hit. $x=NOT $x while $x=1 tooltip("Paused",0,0) Sleep(10) wend tooltip("Running",0,0) endfunc AutoIt3, the MACGYVER Pocket Knife for computers. 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