Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Requires AutoHotkey v2.0
- #InputLevel 1
- #SingleInstance Force
- PID := DllCall("GetCurrentProcessId")
- ProcessSetPriority "High", PID
- A_HotkeyInterval := 0
- specialKey1 := "1"
- specialKey2 := "2"
- specialKey3 := "3"
- specialKey4 := "0"
- Hotkey "^9", Exit
- Hotkey Format("{1}",specialKey1), ClipCopy
- Hotkey Format("{1}",specialKey2), ClipPaste
- Hotkey Format("{1}",specialKey3), SelectAll
- Hotkey Format("{1}",specialKey4), ClickRButton
- RFI_Copy := RapidFireInput()
- RFI_Copy.update(2, 200, "^c", specialKey1)
- ClipCopy(ThisHotkey){
- RFI_Copy.send()
- RepeatHotKey(ThisHotKey)
- }
- RFI_Paste := RapidFireInput()
- RFI_Paste.update(2, 200, "^v", specialKey2)
- ClipPaste(ThisHotkey){
- RFI_Paste.send()
- RepeatHotKey(ThisHotKey)
- }
- RFI_SelectAll := RapidFireInput()
- RFI_SelectAll.update(2, 200, "^a", specialKey3)
- SelectAll(ThisHotkey){
- RFI_SelectAll.send()
- RepeatHotKey(ThisHotKey)
- }
- RFI_RButton := RapidFireInput()
- RFI_RButton.update(2, 200, "{RButton}", specialKey4)
- ClickRButton(ThisHotkey){
- RFI_RButton.send()
- RepeatHotKey(ThisHotKey)
- }
- RepeatHotKey(ThisHotKey){
- state := GetKeyState(ThisHotKey, "P")
- Sleep 25
- iterations := 0
- while(state == 1){
- state := GetKeyState(ThisHotKey, "P")
- Sleep 25
- iterations += 1
- if(iterations > 5){
- Send ThisHotKey
- }
- }
- }
- Exit(ThisHotkey){
- ExitApp
- }
- class RapidFireInput {
- keyPressesRequired := 2
- countKeyPresses := 0
- timeStarted := A_TickCount
- delayTime := 200
- originalKey := "1"
- inputToSend := "^c"
- keyTimer := ObjBindMethod(this, "checkTime")
- iterations := 0
- update(kp, ds, key, oKey){
- this.keyPressesRequired := kp
- this.delayTime := ds
- this.inputToSend := key
- this.originalKey := oKey
- }
- send(){
- if(this.countKeyPresses == 0){
- this.timeStarted := A_TickCount
- this.countKeyPresses += 1
- SetTimer this.keyTimer, 10
- }
- else if(this.countKeyPresses == this.keyPressesRequired - 1 && A_TickCount - this.timeStarted <= this.delayTime){
- this.countKeyPresses := 0
- Send Format("{1}", this.inputToSend)
- SetTimer this.keyTimer, 0
- ;MsgBox "Test2"
- }
- else if(this.countKeyPresses > 0 && A_TickCount - this.timeStarted > this.delayTime){
- this.countKeyPresses := 0
- SetTimer this.keyTimer, 0
- }
- else{
- this.countKeyPresses += 1
- }
- ;Tooltip Format("{1}`n{2}`n{3}", this.countKeyPresses, this.timeStarted, A_TickCount)
- }
- checkTime(){
- if(this.countKeyPresses < this.keyPressesRequired && A_TickCount - this.timeStarted > this.delayTime){
- this.countKeyPresses := 0
- Send Format("{1}", this.originalKey)
- this.iterations := 0
- SetTimer this.keyTimer, 0
- }
- this.iterations += 1
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement