Help with Numpad as 2o keyboard Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
cinara
Posts: 4
Joined: 05 Jul 2022, 10:12

Help with Numpad as 2o keyboard

Post by cinara » 05 Jul 2022, 10:35

Hi everyone, i am a photographer and i am trying to use a keypad as a shortcut keyboard to make my workflow a litte faster.
Since I use a notebook, i do not want the keys from the notebook numpad to be assigned to the shortcuts.
I already installed @evilC's AutoHotInterception, I can see my numpad id, but I can't figure out how to assign the numpad's keys to the shortcuts.

I already maped everything without to work without the AHI.

Could anyone help me?

My numpad id: 0x248A, 0x8367

The Numpad Keys Code
= Code 13
NumpadDiv Code 309
NumpadMult Code 55
Backspace Code 14
NumpadHome Code 71
NumpadPgUp Code 73
NumpadSub Code 74
NumpadClear Code 76
NumpadAdd Code 78
NumpadEnd Code 79
NumpadPgDn Code 81
NumpadEnter Code 284
Tab Code 15
NumpadIns Code 82
. Code 52

and the maped keys with shortcuts

Code: Select all

#IfWinActive ahk_exe Photoshop.exe

=::+F2  			; action Portraiture
NumpadDiv::+F3  	; action Arrumar Cor de Pele
NumpadMult::+F4  	; action Dentes Brancos
Backspace::^F5		; action Divisão de Frequencia Achatada
NumpadHome::^F6		; action Limpar Fundo
NumpadPgUp::^F7		; action Preto e Branco
NumpadSub::^;		; Flip Horizontal
NumpadClear::+^F 	; Fade
NumpadAdd::^'		; Flip Vertical
NumpadEnd::+F8		; action Dodge n Burn
NumpadPgDn::+^F5	; Content Aware Fill
NumpadEnter::!+^Y	; action Achatar Imagem
Tab::!+^C 			; Content Aware Scale
NumpadIns::^[		; Rotacionar Canva Sentido Anti-Horário
.::^] 				; Rotacionar Canva Sentido Horário

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Help with Numpad as 2o keyboard

Post by BoBo » 05 Jul 2022, 11:26

In case you can't remember all your Numpad key-assignments you might be interested to use your mobile device (smartphone/tablet, with an auto-swap option so your "keyboard" will change based on the application you're using on your PC/Mac) for using AHK-scripts that are finally triggering whatever application. And you can name/label those keys whatever you like! ;)
Matric (Android), Touch Portal (Android/iOS), or similar apps. JFTR.

PS. do you own a webpage so I/we can have a look at your work? :)

cinara
Posts: 4
Joined: 05 Jul 2022, 10:12

Re: Help with Numpad as 2o keyboard

Post by cinara » 05 Jul 2022, 11:44

Hi Bobo, thank you for your sugestion. But it is not a possibility right now to use the smartphone.

I just need help to specify the keyboard, so the numpad keys from my notebook keyboard wouldn't trigger the shortcuts.

You can see my work at https://www.instagram.com/cinara/ Hope you like it! ;)

cinara
Posts: 4
Joined: 05 Jul 2022, 10:12

Re: Help with Numpad as 2o keyboard

Post by cinara » 05 Jul 2022, 12:00

Hi @BoBo . Thank you for your sugestion but useing smartphone or a tablet is not a option right now.

You can see my work at https://www.instagram.com/cinara/ Hope you liked it! ;)

The script is working as it is. But I would love to make it work only on the second usb numpad that I have.
My difficult is how to call the numpad key from this specific usb numpad and assign the shortcut to it.

cinara
Posts: 4
Joined: 05 Jul 2022, 10:12

Re: Help with Numpad as 2o keyboard  Topic is solved

Post by cinara » 05 Jul 2022, 14:34

Just figured out how to do it. Here is the code just in case...

Code: Select all

#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

#SingleInstance force
#Persistent
#include <AutoHotInterception>


AHI := new AutoHotInterception() ; Initializing Interception
keyboardId := AHI.GetKeyboardId(0x248A, 0x8367)
AHI.SubscribeKeyboard(keyboardId, true, Func("KeyEvent"))

KeyEvent(code, state)
{
;{===== "=" Code 13 =====================================
	if (state) & (code=13) {
	IfWinActive ahk_exe Bridge.exe
	CreateFolder("Bruto")
	IfWinActive ahk_exe Bridge.exe
	CreateFolder("Galeria de Escolha")
	IfWinActive ahk_exe Bridge.exe
	CreateFolder("Selecionadas")
	IfWinActive ahk_exe Explorer.EXE
	CreateFolder("Bruto")
	IfWinActive ahk_exe Explorer.EXE
	CreateFolder("Galeria de Escolha")
	IfWinActive ahk_exe Explorer.EXE
	CreateFolder("Selecionadas")
	IfWinActive ahk_exe Photoshop.exe
	Send +{F2} ; action Portraiture
	}
;}

;{===== / NumpadDiv Code 309 =====================================
	if (state) & (code=309) {
	IfWinActive ahk_exe Photoshop.exe
	Send +{F3} ; action Arrumar Cor de Pele
	}
;}

;{===== * NumpadMult Code 55 =====================================
	if (state) & (code=55) {
	IfWinActive ahk_exe Photoshop.exe
	Send +{F4} ; action Dentes Brancos
	}
;}

;{===== Backspace Code 14 =====================================
	if (state) & (code=14) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{F5} ; action Divisão de Frequencia Achatada
	}
;}

;{===== 7 NumpadHome Code 71 =====================================
	if (state) & (code=71) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{F6} ; action Limpar Fundo
	}
;}

;{===== 8 NumpadUP Code 72 =====================================
	if (state) & (code=72) {
	IfWinActive ahk_exe Photoshop.exe
	Send !+^{C} ; Content Aware Scale
	}

;{===== 9 NumpadHome Code 73 =====================================
	if (state) & (code=73) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{F7} ; action Preto e Branco
	}
;}

;{===== - NumpadSub Code 74 =====================================
	if (state) & (code=74) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{;} ; Flip Horizontal
	}
;}

;{===== 4 NumpadLeft 75 =====================================
	if (state) & (code=75) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{[} ; Rotacionar Canva Sentido Anti-Horário
	}
;}

;{===== 5 NumpadClear Code 76 =====================================
	if (state) & (code=76) {
	IfWinActive ahk_exe Photoshop.exe
	Send +^{F} ; Fade
	}
;}

;{===== 6 NumpadRight 77 =====================================
	if (state) & (code=77) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{]} ; Rotacionar Canva Sentido Horário
	}
;}

;{===== + NumpadAdd Code 78 =====================================
	if (state) & (code=78) {
	IfWinActive ahk_exe Photoshop.exe
	Send ^{'} ; Flip Vertical
	}
;}

;{===== 1 NumpadEnd Code 79 =====================================
	if (state) & (code=79) {
	IfWinActive ahk_exe Photoshop.exe
	Send +{F8} ; action Dodge n Burn
	}
;}

;{===== 2 NumpadDown Code 80 =====================================
	if (state) & (code=80) {
	Send {Up} ; Seta Cima
	}
;}

;{===== 3 NumpadPgDn Code 81 =====================================
	if (state) & (code=81) {
	IfWinActive ahk_exe Photoshop.exe
	Send +^{F5} ; Content Aware Fill
	}
;}

;{===== NumpadEnter Code 284 =====================================
	if (state) & (code=284) {
	IfWinActive ahk_exe Photoshop.exe
	Send !+^{Y} ; action Achatar Imagem
	}
;}

;{===== Tab Code 15 =====================================
	if (state) & (code=15) {
	Send {Left} ; Seta Esquerda
	}
;}

;{===== 0 NumpadIns Code 82 =====================================
	if (state) & (code=82) {
	Send {Down} ; Seta Baixo
	}
;}

;{===== . Code 52 =====================================
	if (state) & (code=52) {
	Send {Right} ; Seta Direita
	}
;}

}

; functions
CreateFolder(FolderName) {
	Send, ^+n
	Send, %FolderName%
	Send, {Enter}
	Sleep, 500
	}

;{============= Maintenance =============================
^Esc::ExitApp	; Ctrl+Esc to terminate the script
^!p::Pause    ; Pause script with Ctrl+Alt+P
^!s::Suspend  ; Suspend script with Ctrl+Alt+S
^!r::Reload   ; Reload script with Ctrl+Alt+R
;}

Post Reply

Return to “Ask for Help (v1)”