Jump to content

Loop until Keydown


Recommended Posts

Okay, I'm an AutoIt newbie, but I used to do some things with VB about 6 or 7 years ago. Nowadays, I usually just create simple macros with ACTool, but it's not cooperating the way I want it to, so I have switched over to AutoIt.

I am trying to create a macro that continually presses {F1} then MouseClick("left") right after it, until the numberpad + is pressed, which terminates or pauses the program.

So far I have:

Send ("{F1}")
MouseClick("left")

Pretty simple, huh? That works fine, but I am not sure how to loop it until numberpad + is pressed. I have read documentation on AutoIt for close to two hours now, but have nothing to help me. Now, I knew how to do it in ACTool, but since I've never used AutoIt before, I have no clue.

Thanks in advance!

Edited by Skizzy
Link to comment
Share on other sites

Maybe something like this.

#include <Misc.au3>

$dll = DllOpen("user32.dll")

Do
    Send ("{F1}")
    MouseClick("left")
Until _IsPressed('6B', $dll)

DllClose($dll)oÝ÷ ØêÚºÚ"µÍÚ[ÛYH  ÓZØË]LÉÝÂÌÍÙHÜ[   ][ÝÝÙÌ  ][ÝÊBÚ[HÝÒÔÜÙY
    ÌÎNÍÌÎNË  ÌÍÙ
BÙ[
    ][ÝÞÑ_I][ÝÊBS[ÝÙPÛXÚÊ ][ÝÛY ][ÝÊHÑ[ÛÜÙJ   ÌÍÙ

Cheers

Edit: You beet me to it alex OF DEATH ...lol

And the send for Numbpad + is NUMPADADD :shocked:

Edited by smashly
Link to comment
Share on other sites

Thanks for the replies! I made something almost exactly like alex OF DEATH's, even before I read his reply! :(

I ended up with

Hotkeyset ("{NUMPADADD}" "Terminate")

While 1 = 1
    Send ("{F1}")
    MouseClick ("left")
WEnd

Func Terminate()
    Exit 0
EndFunc

First time around, I had to reboot my computer because I forgot to set a Exit command.. that wasn't fun. :shocked:

Thanks again for the replies guys.

Edited by Skizzy
Link to comment
Share on other sites

I'm only following the example from the Help file...

DllOpen....

No need, this should work fine.

HotkeySet("{NUMPADADD}","StartPause")
HotkeySet("{ESC}","Quit")
$pause=False
While 1
Sleep(1000)
WEnd
Func Startpause()
$pause=Not $pause
While $Pause=True
Send("{F1}")
Mouseclick("left")
WEnd
EndFunc
Func Quit()
Exit
EndFunc

You don't have to exit your program, you can just set it so you can activiate it anytime.

Edited by Generator
Link to comment
Share on other sites

No need, this should work fine.

HotkeySet("{NUMPADADD}","StartPause")
HotkeySet("{ESC}","Quit")
$pause=False
While 1
Sleep(1000)
WEnd
Func Startpause()
$pause=Not $pause
While $Pause=True
Send("{F1}")
Mouseclick("left")
WEnd
EndFunc
Func Quit()
Exit
EndFunc

You don't have to exit your program, you can just set it so you can activiate it anytime.

Cuz this way works the best
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...