StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
asdf14  
#1 Posted : Monday, May 30, 2022 2:36:46 PM(UTC)
asdf14

Rank: Newbie

Reputation:

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.
Rob  
#2 Posted : Monday, May 30, 2022 3:33:27 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 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);
}
thanks 1 user thanked Rob for this useful post.
asdf14 on 5/31/2022(UTC)
Rob  
#3 Posted : Monday, May 30, 2022 3:34:27 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 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.
thanks 1 user thanked Rob for this useful post.
asdf14 on 5/31/2022(UTC)
asdf14  
#4 Posted : Tuesday, May 31, 2022 12:27:34 AM(UTC)
asdf14

Rank: Newbie

Reputation:

Groups: Approved
Joined: 6/10/2021(UTC)
Posts: 5

Thanks: 4 times
Originally Posted by: Rob Go to Quoted Post
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!Love
enfantreble  
#5 Posted : Monday, December 19, 2022 12:30:32 PM(UTC)
enfantreble

Rank: Newbie

Reputation:

Groups: Approved
Joined: 5/10/2022(UTC)
Posts: 8
Japan
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)
Rob  
#6 Posted : Monday, December 19, 2022 1:59:21 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Originally Posted by: enfantreble Go to Quoted Post
@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.

Users browsing this topic
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.