Sign in to follow this  
Followers 0
sgmailer

New to AutoIt: Need Help!

8 posts in this topic

Hi,

I'm trying to write a simple program to perform one mouse click and then infinitely press a single key at regular intervals.

Can anybody help me out?

Thanks and if anyone can point to any tutorials, that would also be appreciated.

Share this post


Link to post
Share on other sites



you look at

While / Wend - MouseClick() - and _IsPressed or Send() for the single key

Note: _IsPressed is a Beta UDF... The others you'll be able to find in the ever precious Help File of AutoIt, probably the closest thing thus far to a tutorial with working examples on each function.


[center]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.[/center]

Share this post


Link to post
Share on other sites

Hmm...I was wondering, if I use an infinite loop, how will I get out of the loop after I run the script?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

With a While you'll use ExitLoop or HotKey... Do / Until a certain criteria you set becomes true - For / Next... the number of times you wanted to go through the command.

Edit:

If you look at HotKeySet in the help file, something like Pause or Terminate, you could use for any part of your script or any loop. Most of us use them at some point in our scripts, and some of us always.

Edited by ronsrules

[center]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.[/center]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ah, I didn't even do a hotkey since I'm not familiar with that, I just resorted to click on the taskbar icon to end the loop. :-P

Anyway, since I already know JAVA and in that language, they also have for, do-while, and while loops. I figure I would just do a infinite loop with a do loop.

My first program!

MouseClick("left", 600, 500, 1)

$count = 1
Do
    Send("s")
;Sleep(200)
    
    $count = $count + 1  
Until $count < 0

Thanks for all the help!

Edited by sgmailer

Share this post


Link to post
Share on other sites

Welcome to the forums!

Your script can also be written this way (anything not equal to 0 can be interpreted as a True Boolean, which you would be familiar with given your Java experience):

MouseClick('', 600, 500)
While 1
    Send('s')
   ; Sleep(200)
WEnd

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  
Followers 0