How do I configure hotkeys to be used in only one program

Get help with using AutoHotkey and its commands and hotkeys
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

How do I configure hotkeys to be used in only one program

Post by fefe128 » 20 Jan 2021, 18:20

Please how do I configure hotkeys to be used in only one program? The problem is that I use more Hotkeys. For example, alt + F1, al + F2, alt + F3. Please do not give me the manual. :)
I would like you to write me the exact command :) Thank you very much
Last edited by BoBo on 20 Jan 2021, 19:00, edited 1 time in total.
Reason: Changed subject line from 'Používanie klávesových skratiek iba v jednom programe' to 'How do I configure hotkeys to be used in only one program' for obvious reason.
mcl
Posts: 86
Joined: 04 May 2018, 16:35

Re: Používanie klávesových skratiek iba v jednom programe

Post by mcl » 20 Jan 2021, 18:57

Code: Select all

#IfWinActive Notepad
!F1::
	MsgBox, It's notepad
	Return

#IfWinActive ahk_class CabinetWClass
!F1::
	MsgBox, It's Windows explorer
	Return

#If
!F1::
	MsgBox, It's something else
	Return
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: How do I configure hotkeys to be used in only one program

Post by fefe128 » 20 Jan 2021, 19:02

Like this. I would like to set up hotkeys for Snap Camera only. And I use more hotkeys. For example alt + F1, alt + F2, alt + F3. Could you write me a command of exactly this? Thank you very much. It would help me a lot because I've already despaired :(
BoBo
Posts: 4333
Joined: 13 May 2014, 17:15

Re: How do I configure hotkeys to be used in only one program

Post by BoBo » 20 Jan 2021, 19:24

Code: Select all

#IfWinActive Snap Camera
!F1::MsgBox % "You've pressed " A_ThisHotkey
!F2::MsgBox % "You've pressed " A_ThisHotkey
!F3::MsgBox % "You've pressed " A_ThisHotkey
#If
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: How do I configure hotkeys to be used in only one program

Post by fefe128 » 20 Jan 2021, 19:36

Thank you very much. as soon as I get out of work I'll try it
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: How do I configure hotkeys to be used in only one program

Post by fefe128 » 20 Jan 2021, 19:51

@BoBo
how do I enter a command for the exact path to the Snap Camera program? Will it work even if the snap camera is minimized?
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: How do I configure hotkeys to be used in only one program

Post by fefe128 » 21 Jan 2021, 13:23

Unfortunately, even after these commands, I can't get the keyboard shortcut to click only into the Snap camera program and click into the entire windows. Please give some advice on how to set the keyboard shortcuts alt + F1, alt + F2 alt + F3 to click only into the Snap Camera program.
I need the keyboard shortcuts alt + F1, alt + F2, alt + F3 to click only into the Snap Camera program and bets elsewhere to be inactive
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: How do I configure hotkeys to be used in only one program

Post by fefe128 » 21 Jan 2021, 16:00

So can't it be done with autohotkey? :crazy:
User avatar
mikeyww
Posts: 5104
Joined: 09 Sep 2014, 18:38

Re: How do I configure hotkeys to be used in only one program

Post by mikeyww » 21 Jan 2021, 16:04

See WinTitle. You can use ahk_exe followed by the process name.
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: How do I configure hotkeys to be used in only one program

Post by fefe128 » 21 Jan 2021, 16:56

@mikeyww
Please, sir, could you write me the exact command with the hotkeys alt + F1, alt + F2, alt + F3 so that these hotkeys only work for Snap Camera and do not work in other programs at all? I am desperate :(
Sorry, I don't understand the commands. I know how to run an existing command but I can't create it :( still click into the whole PC.
I would also need a command when the Snap Camera Application is minimized to make hotkeys work only for this application for nothing else.

my way to the program is:

C:\Program Files\Snap Inc\Snap Camera\Snap Camera.exe
User avatar
mikeyww
Posts: 5104
Joined: 09 Sep 2014, 18:38

Re: How do I configure hotkeys to be used in only one program

Post by mikeyww » 21 Jan 2021, 17:46

Try the following as a "proof of concept" test.

Code: Select all

#IfWinActive ahk_exe Snap Camera.exe
F3::MsgBox, Test
#IfWinActive
Note: you must first run this script, and must also activate Snap Camera before pressing F3 to trigger the hotkey. See if that works.

I am not aware of a way that you will be able to work easily with minimized windows. Generally speaking, minimized windows cannot receive the standard AHK send actions. To my knowledge, ControlSend, which can send to some inactive windows, still requires a visible window that is not minimized.
fefe128
Posts: 10
Joined: 20 Jan 2021, 18:08

Re: Ako môžem nastaviť klávesové skratky, ktoré majú byť použité len v jednom programe

Post by fefe128 » 21 Jan 2021, 18:09

@mikeyww

This command wrote to me table. when I have clicked the cape on the snap camera window. see Attachment

Thank you sir. I use Snap Camera to change the face where there are various filters that and activate with shortcuts. The problem is that when I set, for example, Hotkey alt + F3 and start, for example, the game Counter-Strike: Global Offensive and I have pressed the CTRL, filter it is not activated because it is disturbed by CTRL. I thought that the AutoHotkey program could be used to make the keyboard shortcut alt + F3 just click into the Snap Camera program to activate the filter.
Maybe if you could deactivate the CTRL key so that it didn't interfere with the Snap Camera?
Attachments
sadadaczczc.png
sadadaczczc.png (1.85 KiB) Viewed 77 times
User avatar
mikeyww
Posts: 5104
Joined: 09 Sep 2014, 18:38

Re: How do I configure hotkeys to be used in only one program

Post by mikeyww » 21 Jan 2021, 21:33

I do not have a way to test, but you now know that you can use #IfWinActive to limit where the hotkey is active. If you want the hotkey to be active in your game, then you could change that directive to refer to the game's process name, instead of Snap Camera. Perhaps you get the idea.

If you need Alt+F3 to be active when also pressing Ctrl, there are various ways to do it. One is to make an additional hotkey that includes Ctrl. An example is below.

Code: Select all

!F3::
^!F3::MsgBox, test
Best of luck!
Post Reply

Return to “Ask For Help”