0
votes

I'm using the following script to run a bunch of commands when pressing Ctrl-Alt-I and then following with a key of p, k or u. How can I change this to wait like 2 seconds for the next key, or otherwise just send Ctrl-Alt-I and stop waiting on the next key

^!i::
Input key, I L1
IfEqual key,p
   Run, "C:\Temp"
IfEqual key,k
   Run, "C:\Temp\1"
IfEqual key,u
   Run, "C:\Temp\2"
Return
1

1 Answers

1
votes

Like this?

$^!i::
    Input key1, I L1 T2 ;wait 2 seconds for a keypress
    If (key1 = "p" || key1 = "k" || key1 = "u") { ;if p, k or u were pressed
        If (key1 = "p") { ;if the first key we waited for was p:
            Run, "C:\Temp"
        } Else If (key1 = "k") { ;if the first key we waited for was k:
            Run, "C:\Temp\1"
        } Else If (key1 = "u") { ;if the first key we waited for was u:
            Run, "C:\Temp\2"
        } Else {
            SendInput, ^!i
        }
    }
Return