Rank: Newbie
Groups: Approved
Joined: 6/10/2021(UTC) Posts: 5
Thanks: 4 times
|
Make hotkeys work only in specific programs. I set a hotkey that I will use when I use a certain program, but when I exit that program, I have to go to the settings to turn off that hotkey, otherwise it will affect other programs.
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,315  Location: Tampa, FL Thanks: 28 times Was thanked: 412 time(s) in 352 post(s)
|
You can do something like this. In this example, the hotkey is defined as just the h key. If the active window is Photoshop, it sends Control+H otherwise it sends h for any other app. Code:if(sp.ForegroundWindow().ExecutableName == "Photoshop.exe") {
sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_H]);
} else {
sp.SendVKey(vk.VK_H);
}
|
 1 user thanked Rob for this useful post.
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,315  Location: Tampa, FL Thanks: 28 times Was thanked: 412 time(s) in 352 post(s)
|
I will add the feature request, but it's a lot of changes internally as I didn't originally set up hotkeys to be application-specific.
|
 1 user thanked Rob for this useful post.
|
|
|
Rank: Newbie
Groups: Approved
Joined: 6/10/2021(UTC) Posts: 5
Thanks: 4 times
|
Originally Posted by: Rob  You can do something like this. In this example, the hotkey is defined as just the h key. If the active window is Photoshop, it sends Control+H otherwise it sends h for any other app. Code:if(sp.ForegroundWindow().ExecutableName == "Photoshop.exe") {
sp.SendModifiedVKeys([vk.LCONTROL], [vk.VK_H]);
} else {
sp.SendVKey(vk.VK_H);
}
Thank you so much!
|
|
|
|
Rank: Newbie
Groups: Approved
Joined: 5/10/2022(UTC) Posts: 8  Location: Tokyo Thanks: 1 times Was thanked: 1 time(s) in 1 post(s)
|
@rob, is there any difference in terms of effect if I do all my dispatching in a Global gesture (if app==X sendVkey(Y), etc), rather than use the Applications Menu? I prefer to keep all the loging in one place, rather to miss some app speciffic overrides (btw, folks don't do sp.SendVKey(vk.DELETE) if you don't know exactly what you ase doing)
|
|
|
|
Rank: Administration
Groups: Translators, Members, Administrators Joined: 1/11/2018(UTC) Posts: 1,315  Location: Tampa, FL Thanks: 28 times Was thanked: 412 time(s) in 352 post(s)
|
Originally Posted by: enfantreble  @rob, is there any difference in terms of effect if I do all my dispatching in a Global gesture (if app==X sendVkey(Y), etc), rather than use the Applications Menu? I prefer to keep all the loging in one place, rather to miss some app speciffic overrides (btw, folks don't do sp.SendVKey(vk.DELETE) if you don't know exactly what you ase doing) No real difference. Using applications is just to categorize things and apply custom settings to actions or general behavior within an application.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close