Sign in to follow this  
Followers 0
Deathlord9100

Keystroke Macro

3 posts in this topic

Hey guys and girls. I have been trying to find a way to make a keystroke macro for a while now and a friend of mine suggested Auto It. I just started using it today and am very unfamiliar with the syntax for the language but here is what I have so far.

; Small project for a macro that hits the control and space key every 5 seconds 1000 times with the option to stop in on a GUI. 

;Variables
Global $LootNumber = 0

;Timer
$timer1 = TimerInit()

;GUI
GUICreate("Deathlord's SOTNW Looter Macro", 100, 100)
GUICtrlCreateButton("Stop", 50, 25 )

Do
    Send("Ctrl");I don't know what the correct syntax is for hitting the control key or the space bar so I am using this as an example. 
    Send("Space");Need to hit both the space bar and the control key at the same time or hold the control key and press the space bar in that order. Either works.
    $LootNumber += 1;Keeping track of how many times the loop has been run.
    Sleep(5000);I could not figure out if this was counted in miliseconds or if it was counted in seconds so if it is seconds then it would have to change.
Until $LootNumber >= 1000

I know it is really crappy and most of my syntax is probably messed up but I need some help. Here is my goal:

First of all I need the macro to hit the control and space key at the same time every 5 seconds (actually it could also be the control key first but then held down and then the space key).

Second I need to have a GUI that has the option to stop the program at any time and displays the number of times the loop has gone through.

Third I need it to go through 1000 times total and then stop the macro.

I think some of my code is right but my send syntax is wrong because I want to send the keystroke not the actual text. Also the GUI I am having some trouble understanding.

Any and all help is greatly appreciated. THANKS ;D.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

The help file has plenty of examples, just look under Send.

Send("^{SPACE}") = CTRL+Spacebar.

Sleep(1000) = 1 second

Edited by Fossil Rock

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Share this post


Link to post
Share on other sites

hi

i maked a simple script for "sword of the new world"

it is just 3 days old and i need some more expiriense to make some helpfully funktion but is work

and these script only works wen you not touch the game after runing

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Programme\AutoIt3\Koda\Forms\sotnw1-test.kxf
$Form1 = GUICreate("sotnw gui auto-loot", 100, 80, 80, 80)
$start = GUICtrlCreateButton("start", 50, 40, 40, 20, 0)
;$stop = GUICtrlCreateButton("stop", 225, 110, 110, 50, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While True
    WinActivate ("sotnw gui auto-loot")
    Sleep(5000)
    WinActive ("Sword of the New World")
    WinActivate ("Sword of the New World")
    Sleep(1000)
    Send("^{SPACE}")
    Sleep(2000)
    Send ("{CTRLDOWN}{E}")
    Send("{CTRLUP}")
    Send("{SHIFTDOWN}")
    Send("{SHIFTUP}")
    Sleep(8000)
    WinActive ("sotnw gui auto-loot")
;WinActivate ("sotnw gui auto-loot")
WEnd

it not finish now i dont no to creat funktion for exit ,break or just a inputbox for delay change

and so far it needs a label for just display the loop time ,how long runing!

but loot-ing is posiple and it works whitout errors

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