Jump to content
Sign in to follow this  
ab21

How to read user input?

Recommended Posts

ab21

Hi all, i'm new to autoit and i want to write a script that will send in keystrokes automatically for infinite times untill the user hits "esc".

I know how to set a hotkey and exit the program but how to actually set a hotkey and "pause" the script and use the same hot key to "re-enable" the script?

another little problem is, i read about how to send in a keystroke for a specific amount of times, but how can i make the script to enter the keystroke for infinite times for 5 times per second? will it work if i put send() & sleep(200) inside a loop?

Edited by ab21

Share this post


Link to post
Share on other sites
zcoacoaz

RTM, my friend, RTM (Read The Manual) and yes you can have more than one command in a loop


[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Share this post


Link to post
Share on other sites
ab21

srry i just started reading about autoit about an hour ago, i haven't d/l'd the program yet, about the send() & sleep(200) part, i just wanted to know if that'll allow the script to send a keystroke for infinite times with 200 milisec wait.

Share this post


Link to post
Share on other sites
ShelbySue

HotKeySet will allow you to capture a key press. read the Doc on that.

Share this post


Link to post
Share on other sites
herewasplato

srry i just started reading about autoit about an hour ago, i haven't d/l'd the program yet, about the send() & sleep(200) part, i just wanted to know if that'll allow the script to send a keystroke for infinite times with 200 milisec wait.

<{POST_SNAPBACK}>

yes. a script can do what you have asked about...

while 1
   send("A")
   sleep(200)
wend

you might want to add a line or two to bring the window of interest into focus just before sending stuff to it... see winactivate and winwaitactive

as for the pause/resume script code - steal that from the manual which is also online - see the bottom of this page:

http://www.autoitscript.com/autoit3/docs/f...s/HotKeySet.htm

hope this helps


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×