Tuesday 3 April 2018

Autohotkey `1 key sequence


In MSword I would like to set


`1

to be a key sequence to trigger a script but I also have other scripts in MSword with the hotkeys


1

and key sequence


11    ; (one pressed twice fast)

the code goes like this


; The following hotkeys work only if MS-WORD is the active window:
#If WinActive("ahk_exe WINWORD.EXE") ; (1)

1::
if 1_presses > 0
{
1_presses += 1
SetTimer Key1, 300
return
}
1_presses = 1
SetTimer Key1, 300
return

Key1:
SetTimer Key1, off
if 1_presses = 2
SendInput, BYE
else
SendInput, HELLOW
1_presses = 0
return

How can I set the `1 keysequence trigger without interfere with the other hotkeys???


Thanks Advanced.



Answer



#If WinActive("ahk_exe WINWORD.EXE") 

; SC029 is the scancode of the key "`"

; SC029::
; KeyWait, SC029
; return

SC029 Up::
Send {SC029}
return

; press 1 while you're holding down the "`"-key, to send a
SC029 & 1:: Send a

1::
; press 1 in less than 300 ms after pressing the "`"-key, to send b
If (A_PriorHotKey = "SC029 Up" AND A_TimeSincePriorHotkey < 300)
{
Send {BS}b
return
}
; otherwise:
if 1_presses > 0
{
1_presses += 1
SetTimer Key1, 300
return
}
1_presses = 1
SetTimer Key1, 300
return

Key1:
SetTimer Key1, off
if 1_presses = 2
SendInput, BYE
else
SendInput, HELLOW
1_presses = 0
return

#If

No comments:

Post a Comment

Where does Skype save my contact&#39;s avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...