tropunk Posted June 9, 2010 Share Posted June 9, 2010 Hello guys, I just registered here. I've been looking on AutoIt for a week now, amazing language...but got stuck in this one. I'm making a program to input certain characters for certain keys. Here's a smaller version of what I want: HotKeySet("+{S}", "inputA"); Func inputA() Send("a") EndFunc ;==>inputA HotKeySet("+{W}", "inputQ"); Func inputQ() Send("q") EndFunc ;==>inputQ HotKeySet("+{X}", "inputZ"); Func inputZ() Send("z") EndFunc ;==>inputZ Now the problem is, upon executing, the program runs one-off and exits. I want it to run continuously until I press End or something. I tried _isPressed in While/WEnd but then realized functions don't work in loops :-P Is there anything that'll make the program stop until certain key is pressed? It doesn't have the good old getch(); :-( Link to comment Share on other sites More sharing options...
JohnOne Posted June 9, 2010 Share Posted June 9, 2010 Put this at the bottom to keep yout script alive while 1 sleep(1000) wend and add a hotkey for the exit func func _exit() exit endfunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
tropunk Posted June 9, 2010 Author Share Posted June 9, 2010 Put this at the bottom to keep yout script alivewhile 1sleep(1000)wendand add a hotkey for the exit funcfunc _exit()exitendfuncWorked...thanks a lot man!But hey, this seems magic to me.I need a theoretical explaination...the sleep function gets the delay of just 1 sec. then how come its looping continuously? Link to comment Share on other sites More sharing options...
JohnOne Posted June 9, 2010 Share Posted June 9, 2010 Basically the script is just asleep forever/until you exit. HotkeySet function will interupt the current function ( which is Sleep() ) and run the called function. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
tropunk Posted June 9, 2010 Author Share Posted June 9, 2010 Basically the script is just asleep forever/until you exit.HotkeySet function will interupt the current function ( which is Sleep() ) and run the called function.Alright...that great! Never came across this idea Thanks again dude! 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