Numpad

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jrachr
Posts: 543
Joined: 01 Mar 2021, 17:33

Numpad

Post by jrachr » 25 Jun 2022, 05:40

Good Day. Am trying to modify a script I have and am wondering if it possible to map the same numpad key as a hotkey. IE Numpad 3 & Numpad3:: Run or send something. So I would be running Numpad 33,or Numpad 66,etc. Is this possible in ahk?Tk's

User avatar
mikeyww
Posts: 26972
Joined: 09 Sep 2014, 18:38

Re: Numpad

Post by mikeyww » 25 Jun 2022, 05:53

Code: Select all

Numpad3 Up::
KeyWait, Numpad3, DT.3
If ErrorLevel
     Send Once
Else Send Twice
Return

jrachr
Posts: 543
Joined: 01 Mar 2021, 17:33

Re: Numpad

Post by jrachr » 25 Jun 2022, 06:07

Mikey to the rescue. Anyways what I am trying to do is run this script with Numpad33 as the hotkey. What you sent me does not work unless I did something wrong which is entirely possible.

Code: Select all

Numpad3 Up::
KeyWait, Numpad3, DT.3
If ErrorLevel
     Send Once
Else Send Twice
Return
Run, E:\PortableApps\PortableApps\AutoHotkeyPortable\AHK Scripts\Startup menu.ahk

User avatar
mikeyww
Posts: 26972
Joined: 09 Sep 2014, 18:38

Re: Numpad

Post by mikeyww » 25 Jun 2022, 06:14

Unlabeled code following Return is unreachable. Follow the script line by line to see what it does. Perhaps:

Code: Select all

Numpad3 Up::
KeyWait, Numpad3, DT.4
If ErrorLevel
 Send {Numpad3}
Else Run, E:\PortableApps\PortableApps\AutoHotkeyPortable\AHK Scripts\Startup menu.ahk
Return
An alternative is Input.

jrachr
Posts: 543
Joined: 01 Mar 2021, 17:33

Re: Numpad

Post by jrachr » 25 Jun 2022, 06:21

Perfect Mikey. Works like a charm. Knew I was doing something wrong. Must remember that I can't just fire unlabeled code and expect it to work. Even in Ahk. Tk's again Mikey.

User avatar
mikeyww
Posts: 26972
Joined: 09 Sep 2014, 18:38

Re: Numpad

Post by mikeyww » 25 Jun 2022, 06:23

Outside functions, the only place for unlabeled code would be the auto-execute section. Cheers!

Post Reply

Return to “Ask for Help (v1)”