How to pass A_Index to =>
Posted: 27 Oct 2021, 13:42
I want to set up Hotkey in batches
No need to go line by line
Is there any solution?
No need to go line by line
Is there any solution?
Code: Select all
key1 := "a"
action1 := "1"
key2 := "b"
action2 := "2"
key3 := "c"
action3 := "3"
key4 := "d"
action4 := "4"
loop
{
if !IsSet(key%A_Index%) ; key5 Variable not found.
Break
; if key%A_Index% && action%A_Index%
; Hotkey(key%A_Index%, (*) => (Action(action%A_Index%))) ;action0 Variable not found.
i := A_Index
if key%i% && action%i%
Hotkey(key%i%, (*) => (Action(action%i%))) ;all action%i% is 4
}
;line by line and work fine
;if key1 && action1
; Hotkey(key1, (*) => Action(action1))
;if key2 && action2
; Hotkey(key2, (*) => Action(action2))
;if key3 && action3
; Hotkey(key3, (*) => Action(action3))
;if key4 && action4
; Hotkey(key4, (*) => Action(action4))
Action(item)
{
MsgBox item
}