-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasteArray.ahk
More file actions
32 lines (27 loc) · 930 Bytes
/
PasteArray.ahk
File metadata and controls
32 lines (27 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#Requires AutoHotkey v2.0+
; Define global variables
Global currentIndex := 1
Global myArray := []
; Define the hotkey (Alt+Q)
!q:: {
global currentIndex, myArray ; Declare globals inside the function
; Check if the current index is within the bounds of the array
if (currentIndex <= myArray.Length) {
; Send the current string from the array
SendText(myArray[currentIndex])
; Increment the index for the next press
currentIndex++
} else {
; Reset index if we reach the end of the array
; currentIndex := 1
}
}
; Define the hotkey (Alt+W) to resend the previous item
!w:: {
global currentIndex, myArray ; Declare globals inside the function
; Check if we can go back one position (currentIndex is 2 or higher)
if (currentIndex > 1) {
; Send the previous string from the array
SendText(myArray[currentIndex - 1])
}
}