I have searched the net for days looking for a good script to convert my F9 key into a toggle switch to run a simple sequence of key presses.
after trying dozens of scripts I came up with this one, seems to work perfectly for me.
I'm sure someone can find a simpler way to do it. My form is probably bad, but I'm no pro.
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;This AHK script will turn your F9 key into an auto fire button that will run buttons ;
;;;1-0 on your keyboard, I use it in MMORPGs that have alot of buttons to be controled ;
;;;if you want to change the key, set $F9:: to $somekeycombo::, then edit, find replace F9 ;
;;; to somekeycombo. you can set all delay timmers by changing del:=150 to del:=somenumber ;
;;; or set any sleep timmer manualy by replacing (%del% with a number) ;
;;; I am not a pro, I figured this out from reading these forums, trying several methods ;
;;;that all failed, This one works in windows 10, remember to run as admin ;
;;; create shortcut to script, right click and go to copatability window, ;
;;;check run as admin, and save.. or add the RAA code to this script. ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Esc::ExitApp ;Panic button uncomment if you want it
$f9:: ;set key to be used
del:=150 ;set standard sleep timer (variable)
KeyWait f9 ;Change to match key
Loop {
If GetKeyState("f9","p") ;checks for key to be pressed
Break ;if key is pressed stop script
SendInput {1} ;send the key or click that you set
If GetKeyState("f9","p") ;I want to check the toggle after each key
Break
Sleep %del% ;pause between each key send, can be set manualy for each key
SendInput {2}
If GetKeyState("f9","p")
Break
Sleep 149 ;this one is set manualy
SendInput {3}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {4}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {5}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {6}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {7}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {8}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {9}
If GetKeyState("f9","p")
Break
Sleep %del%
SendInput {0}
If GetKeyState("f9","p")
Break
Sleep %del%
}
Return