Author Topic: Trigger commands based on window focus  (Read 5992 times)

0 Members and 2 Guests are viewing this topic.

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Trigger commands based on window focus
« on: July 06, 2012, 05:23:57 AM »
I use MS office and Adobe products daily and for the most part they share the same shortcut keys for their menus, with small variations and added shortcuts, However, a hotkey in MS office might have the same name in Photoshop but uses different key combos.

Is there a way to use the same voice command but have that command trigger something different depending on which program has focus? Like having a universal IF statement.

I want to be able to have some kind of logic control so that when I say a command to Vox... Vox will use X hotkeys if X program has focus or use Y hotkeys if Y program has focus. The voice command I give Vox is the same but the hotkeys it sends are different based on which program has focus.

here is a rough example of what I am trying to do:

Me: COMPUTER OPEN NEW WINDOW
Vox: Checks which program has focus
Vox: if window focus = Photoshop { load photoshop hotkeys payload and send the command }
Vox: else if window focus = MS Word { load MS Word hotkeys payload and send the command }
Vox: else if window focus = Google Chrome { load MS Word hotkeys payload and send the command }

By doing this I could make a universal list of voice commands and have them trigger different hotkeys depending on which program has focus.

Is this at all possible or if it already is possible can you point me in the right direction?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Trigger commands based on window focus
« Reply #1 on: July 06, 2012, 07:40:38 AM »
I use MS office and Adobe products daily and for the most part they share the same shortcut keys for their menus, with small variations and added shortcuts, However, a hotkey in MS office might have the same name in Photoshop but uses different key combos.

Is there a way to use the same voice command but have that command trigger something different depending on which program has focus? Like having a universal IF statement.

I want to be able to have some kind of logic control so that when I say a command to Vox... Vox will use X hotkeys if X program has focus or use Y hotkeys if Y program has focus. The voice command I give Vox is the same but the hotkeys it sends are different based on which program has focus.

here is a rough example of what I am trying to do:

Me: COMPUTER OPEN NEW WINDOW
Vox: Checks which program has focus
Vox: if window focus = Photoshop { load photoshop hotkeys payload and send the command }
Vox: else if window focus = MS Word { load MS Word hotkeys payload and send the command }
Vox: else if window focus = Google Chrome { load MS Word hotkeys payload and send the command }

By doing this I could make a universal list of voice commands and have them trigger different hotkeys depending on which program has focus.

Is this at all possible or if it already is possible can you point me in the right direction?
Yes this is all possible. You can insert a "disable-group" command, I give you a start point in the evening when I'm at home.

Kalle
***********  get excited and make things  **********

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Re: Trigger commands based on window focus
« Reply #2 on: July 06, 2012, 01:58:40 PM »
This is wonderful news, thank you Kalle!

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Trigger commands based on window focus
« Reply #3 on: July 06, 2012, 02:14:57 PM »
This is wonderful news, thank you Kalle!
Haha, I'm on it, take a few minutes  ;)
***********  get excited and make things  **********

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Trigger commands based on window focus
« Reply #4 on: July 06, 2012, 03:57:54 PM »
Ok, here is it  ;)

Import the attached groups with you VC editor. The DxInput plugin must be activated.

The "toggle hotkeys 2" command is exact (I hope) what you search for use it first. The "toggle hotkeys" command is good if there is any other progam focused  ;)

The "toggle hotkeys" command contains logic that processes:
 
1. check your system if word or photoshop process is running.

a.) word is running -> open a new window in word -> activate the hotkey group for word and disable the adobe hotkey group

b.) photoshop is running -> open a new window in photoshop -> activate the hotkey group for adobe and disable the word hotkey group

2. is no process of these programs running -> VC say: "sorry, there running no of these programs to open a new window"

The "toggle hotkeys" do not work if both programs running on the same time  :'(

I hope this is a start point for you  :D
« Last Edit: July 06, 2012, 05:28:50 PM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Trigger commands based on window focus
« Reply #5 on: July 06, 2012, 06:03:09 PM »
I think the best place to start is to create one group with commands that you would normally use for Photoshop so that we can get a better understanding of what you are doing.

If you want you can also create a group of commands for MS Word or other programs too and upload them.

We can go from there.

I'm not 100% sure that you and Kalle are on the same page.  But maybe you are...  I think your example of opening a window may have confused the issue a bit...

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Re: Trigger commands based on window focus
« Reply #6 on: July 06, 2012, 07:26:21 PM »
Ok I see.... I think Kalle has the idea but I will no more once I try his solutions, in the meantime, I will try to explain it better, so here goes.

I have 3 monitors attached to my computer and sometimes when I work I use all 3 of them.

Monitor #1  - MS Word / Outlook or Excel
Monitor #2  - Firefox / and others ( research )
Monitor #3  - Adobe Photoshop / Dreamweaver and some times illustration

I switch between these 3 monitors constantly and I use hotkeys alot. The same hotkey combo triggers different events in each program.
So I don't want to have to remember a different "Phrase" to trigger the hotkey for each program I'm in. I just what to say "NEW Window" and based on what program has focus, be it MS Word or PhotoShop,  Vox will trigger the correct hotkey for that program.


I want to making a group for every program I use, MS Word, Photoshop..etc and in each group I want to have every hotkey that the program supports.
then issue one Phrase to vox, like "open new window" and depending on what program has focus vox will send the correct command.

Does that explanation help clear up any confusion.
« Last Edit: July 06, 2012, 08:05:43 PM by mparks »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Trigger commands based on window focus
« Reply #7 on: July 06, 2012, 08:28:11 PM »
Ok I see.... I think Kalle has the idea but I will no more once I try his solutions, in the meantime, I will try to explain it better, so here goes.

I have 3 monitors attached to my computer and sometimes when I work I use all 3 of them.

Monitor #1  - MS Word / Outlook or Excel
Monitor #2  - Firefox / and others ( research )
Monitor #3  - Adobe Photoshop / Dreamweaver and some times illustration

I switch between these 3 monitors constantly and I use hotkeys alot. The same hotkey combo triggers different events in each program.
So I don't want to have to remember a different "Phrase" to trigger the hotkey for each program I'm in. I just what to say "NEW Window" and based on what program has focus, be it MS Word or PhotoShop,  Vox will trigger the correct hotkey for that program.


I want to making a group for every program I use, MS Word, Photoshop..etc and in each group I want to have every hotkey that the program supports.
then issue one Phrase to vox, like "open new window" and depending on what program has focus vox will send the correct command.

Does that explanation help clear up any confusion.

Hmm, if I understand it correct - (for example) you use monitor1 on which is a WORD window focused, and you say the phrase "open new window" - VC enable the groupe with hotkeys for WORD and disable the hotkey groups for firefox and photoshop so that the phrase  trigger only word hotkeys. If this meant, so the "toggle hotkey 2" command does this, you must edit the enable/disable groups with the group names of your hotkey groups.

Kalle

Edit: You can delete the DxInput keycombo in this command, so VC check only which program has focus and enable the hotkeys for it and disable all others? I have a similar command when I switch between XBMC and Mediamonkey, if XBMC is focused all MM commands are diabled and inverted.
« Last Edit: July 06, 2012, 08:53:35 PM by Kalle »
***********  get excited and make things  **********

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Re: Trigger commands based on window focus
« Reply #8 on: July 06, 2012, 08:57:30 PM »
Good on you Kalle, that's what I am trying to do.
I am going to play with this and see if I can get this going.

Thank you so much.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Trigger commands based on window focus
« Reply #9 on: July 06, 2012, 09:20:39 PM »
you just need to create a group for each program and edit the group properties to tell it that it is only active when a particular program has focus.

In group properties, you just need to enter the name of the process in the "active only for process" text box.  (The process name is usually the name of the program, but you can verify this in process manager when the program is running by hitting Ctrl-Shift-Esc and then clicking the processes tab).

If you different programs use similar hotkeys, you can create one group, and then clone it, and make the necessary adjustments for the next program.

Should be pretty easy.

I recommend that you use inputKeys for keyboard input, and if they don't work for some reason in a particular program, you can try using DxInput plugin.

It's also possible to create custom command to enable and disable different groups, but in this case I think it is simplest to use the group properties, since you will only ever want to use these commands when the program in question has focus.

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Re: Trigger commands based on window focus
« Reply #10 on: July 06, 2012, 10:26:30 PM »
Wow, alot of info here. Good thing I have air conditioning and no plans tonight.  ;D

I found this website, which has a list of almost every hotkey (   http://allhotkeys.com/ )
« Last Edit: July 06, 2012, 10:34:56 PM by mparks »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Trigger commands based on window focus
« Reply #11 on: July 06, 2012, 10:32:35 PM »
Yeah, I hear that Toronto has been pretty toasty lately.   More of a wet toast though, which nobody likes...  :biglaugh

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Re: Trigger commands based on window focus
« Reply #12 on: July 06, 2012, 10:36:17 PM »
Yea, it's like walking into an oven, it's very bad out there right now, I love the heat but this kind of heat is horrible.

mparks

  • $upporter
  • Contributor
  • *****
  • Posts: 93
  • Karma: 0
    • View Profile
Re: Trigger commands based on window focus
« Reply #13 on: July 07, 2012, 12:44:20 AM »

In group properties, you just need to enter the name of the process in the "active only for process" text box.

It's also possible to create custom command to enable and disable different groups, but in this case I think it is simplest to use the group properties, since you will only ever want to use these commands when the program in question has focus.

Can you explain a bit more about the "active only for process", does this mean that all hotkeys in the Abobe group will only work if the Adobe program is active?

so if I use the Phrase "Switch to the next window" while Photoshop is active and in focus it will trigger the hotkeys, then when I give focus to MS Word and issue the same Phrase will trigger the MS word hotkey combo not the photoshop hotkeys combo.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2319
  • Karma: 47
    • View Profile
Re: Trigger commands based on window focus
« Reply #14 on: July 07, 2012, 05:18:07 AM »
you just need to create a group for each program and edit the group properties to tell it that it is only active when a particular program has focus.

In group properties, you just need to enter the name of the process in the "active only for process" text box.  (The process name is usually the name of the program, but you can verify this in process manager when the program is running by hitting Ctrl-Shift-Esc and then clicking the processes tab).

If you different programs use similar hotkeys, you can create one group, and then clone it, and make the necessary adjustments for the next program.

Should be pretty easy.

I recommend that you use inputKeys for keyboard input, and if they don't work for some reason in a particular program, you can try using DxInput plugin.

It's also possible to create custom command to enable and disable different groups, but in this case I think it is simplest to use the group properties, since you will only ever want to use these commands when the program in question has focus.
  ::duh Oh, I have forgot this properties. This is really the best solution.  :clap
***********  get excited and make things  **********