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,224
United States
Location: Tampa, FL

Thanks: 27 times
Was thanked: 378 time(s) in 328 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,224
United States
Location: Tampa, FL

Thanks: 27 times
Was thanked: 378 time(s) in 328 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
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.