Code: Select all
"Numpad1"
Code: Select all
"Numpad5"
Code: Select all
"Numpad1 & Numpad3"
What is the simplest way to
Code: Select all
Numpaddot::
Code: Select all
"Numpad1"
Code: Select all
"Numpad5"
Code: Select all
"Numpad1 & Numpad3"
Code: Select all
Numpaddot::
Code: Select all
Numpad1::
ch=1
gosub sendroutine
return
Numpad2::
ch=9
gosub sendroutine
return
...
Numpad1 & Numpad2::
ch=122
gosub sendroutine
return
Numpad1 & Numpad3::
ch=137
gosub sendroutine
return
etc...
Code: Select all
last_sent_Numpad_command = Numpaddot
Numpad1::
ch=1
gosub sendroutine
return
Numpad2::
ch=9
gosub sendroutine
return
; ...
Numpad1 & Numpad2::
ch=122
gosub sendroutine
return
Numpad1 & Numpad3::
ch=137
gosub sendroutine
return
Numpaddot::
IF (last_sent_Numpad_command <> A_ThisHotkey)
Goto, %last_sent_Numpad_command%
Return
sendroutine:
IF InStr(A_ThisHotkey, "Numpad")
last_sent_Numpad_command := A_ThisHotkey
SoundBeep, 4000, 20
ToolTip,% ch
;...
Return
Code: Select all
IF last_sent_Numpad_command <> A_ThisHotkey
Code: Select all
IF InStr
Code: Select all
sendroutine:
if ch between 0 and 8
{
IF InStr(A_ThisHotkey, "Numpad")
last_sent_Numpad_command := A_ThisHotkey
send ^g
send %ch%
send {enter}
return
}
if ch>8
{
IF InStr(A_ThisHotkey, "Numpad")
last_sent_Numpad_command := A_ThisHotkey
send ^g
send %ch%
send {enter}
send {f9 3}
return
}
return
Code: Select all
last_sent_Numpad_command = Numpaddot
Numpad1::
ch=1
gosub sendroutine
return
Numpad2::
ch=9
gosub sendroutine
return
; ...
Numpad1 & Numpad2::
ch=122
gosub sendroutine
return
Numpad1 & Numpad3::
ch=137
gosub sendroutine
return
Numpaddot::
IF (last_sent_Numpad_command <> A_ThisHotkey)
Goto, %last_sent_Numpad_command%
Return
sendroutine:
if ch between 0 and 8
{
IF InStr(A_ThisHotkey, "Numpad")
last_sent_Numpad_command := A_ThisHotkey
send ^g
send %ch%
send {enter}
return
}
if ch>8
{
IF InStr(A_ThisHotkey, "Numpad")
last_sent_Numpad_command := A_ThisHotkey
send ^g
send %ch%
send {enter}
send {f9 3}
return
}
return
Code: Select all
#NoEnv
Numpad1::sendroutine(last_sent_Numpad_command := "Numpad1")
Numpad2::sendroutine(last_sent_Numpad_command := "Numpad2")
Numpad1 & Numpad2::sendroutine(last_sent_Numpad_command := "Numpad1 & Numpad2")
Numpad1 & Numpad3::sendroutine(last_sent_Numpad_command := "Numpad1 & Numpad3")
NumpadDot::
if (last_sent_Numpad_command)
Goto, %last_sent_Numpad_command%
return
sendroutine(A_Hotkey) {
static ch := {"Numpad1":1,"Numpad2":9,"Numpad1 & Numpad2":122,"Numpad1 & Numpad3":137}
send ^g
send % n := ch[A_Hotkey]
send {enter}
if (n > 8)
send {f9 3}
}
With this exact code, and when ch<9, numpaddot increases ch by 1. When ch>9, it increases ch by 4Rohwedder wrote: ↑18 Aug 2022, 01:05it keeps adding +1 to ch?
Here with this code this does not happen:The Numpad+Number Hotkeys each send the ch value + Enter, Numpaddot:: repeats this.Code: Select all
last_sent_Numpad_command = Numpaddot Numpad1:: ch=1 gosub sendroutine return Numpad2:: ch=9 gosub sendroutine return ; ... Numpad1 & Numpad2:: ch=122 gosub sendroutine return Numpad1 & Numpad3:: ch=137 gosub sendroutine return Numpaddot:: IF (last_sent_Numpad_command <> A_ThisHotkey) Goto, %last_sent_Numpad_command% Return sendroutine: if ch between 0 and 8 { IF InStr(A_ThisHotkey, "Numpad") last_sent_Numpad_command := A_ThisHotkey send ^g send %ch% send {enter} return } if ch>8 { IF InStr(A_ThisHotkey, "Numpad") last_sent_Numpad_command := A_ThisHotkey send ^g send %ch% send {enter} send {f9 3} return } return
Thanks, but because this does not affect ch again, gives me problems.Xtra wrote: ↑18 Aug 2022, 11:04Something different:Code: Select all
#NoEnv Numpad1::sendroutine(last_sent_Numpad_command := "Numpad1") Numpad2::sendroutine(last_sent_Numpad_command := "Numpad2") Numpad1 & Numpad2::sendroutine(last_sent_Numpad_command := "Numpad1 & Numpad2") Numpad1 & Numpad3::sendroutine(last_sent_Numpad_command := "Numpad1 & Numpad3") NumpadDot:: if (last_sent_Numpad_command) Goto, %last_sent_Numpad_command% return sendroutine(A_Hotkey) { static ch := {"Numpad1":1,"Numpad2":9,"Numpad1 & Numpad2":122,"Numpad1 & Numpad3":137} send ^g send % n := ch[A_Hotkey] send {enter} if (n > 8) send {f9 3} }
Code: Select all
NumpadX::
ch=Y
gosub sendroutine
return
Code: Select all
#NoEnv
Numpad1::
Numpad2::
Numpad1 & Numpad2::
Numpad1 & Numpad3::ch := sendroutine(last_sent_Numpad_command := A_ThisLabel)
NumpadDot::
if (last_sent_Numpad_command)
Goto, %last_sent_Numpad_command%
return
sendroutine(A_Hotkey) {
static chArr := {"Numpad1":1,"Numpad2":9,"Numpad1 & Numpad2":122,"Numpad1 & Numpad3":137}
send ^g
send % n := chArr[A_Hotkey]
send {enter}
if (n > 8)
send {f9 3}
return n
}
Code: Select all
sendcharts(A_Hotkey) {
static chArr := {"Numpad1":1,"Numpad2":3,"Numpad3":15,"Numpad4":27,"Numpad5":39,"Numpad6":51,"Numpad7":63}
send ^g
send % n := chArr[A_Hotkey]
send {enter}
;;;;;;;;;;;; add one to n.. (n+1), then send % n again
send ^g
send % n := chArr[A_Hotkey]
send {enter}