Jump to content

Setting up a macro


Recommended Posts

Im fairly new to Autoit and computer languages as a whole but i feel im learning fairly quickly.

Im a little bit stumped on 1 thing.

What i want to do is make a script that will let me hit a button and have it keep spamming that button until i tell it to stop.

I tried a bunch of different things and i cant get anything to work. The best i can come up with is something along the lines of:

Winactivate("World of Warcraft")

Hotkeyset("{Pause}","Macro")

Func Macro()

Send("{- down}")

EndFunc

Dont make fun of me too much. I know i suck and thats probably insanely far off from what i need to do. Thats why im here asking for help. Atleast i tried :)

I want to be able to hit my hotkey (In this case Pause/Break key) and have it spam the key in the send line (In this case -) I'm sure this is possible im just not exactly sure what i did wrong.

Edited by Dakidd4990
Link to comment
Share on other sites

See how this works, learn.

Global $sTOP = False

Winactivate("World of Warcraft")
Hotkeyset("{Pause}","Macro") ; register hotkey

Func Macro()
    Beep(800,100)
    Hotkeyset("{Pause}")            ; Un register hotkey
    Hotkeyset("{Pause}","_stop")    ; register hotkey   
    
    While 1
        Sleep(1000)             ; send Down every 1 second
        Send("{down}")
        
        If $sTOP = True Then 
            $sTOP = False
            Return              ; IF tRUE THEN EXIT FUNCTION
        EndIf
    WEnd

EndFunc


Func _stop()
    Beep(800,100)
    Hotkeyset("{Pause}")            ; Un register hotkey
    Hotkeyset("{Pause}","Macro")    ; register hotkey   
    
    $sTOP = True
EndFunc


While 1
    Sleep(100) ; keep script alive
WEnd
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
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...