Author Topic: Command execution exception for one window only  (Read 1314 times)

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Command execution exception for one window only
« on: April 08, 2021, 05:18:11 AM »
Hello everyone,

I would like to create a command execution "exception" for a separate window or application from some commands in my general profile.

Let me explain.

I would like that if I am in a "Vectorworks Studio*" window the command "roulette maison;roue maison;remonte; remonter;monter;up" does not execute but that the other commands of the profile execute.
Can we ask a profile command to run in a specific window, but can we ask it not to run in that window?

See attachment.

I hope that I have been clear enough, do not hesitate to ask me for clarification if I have not.

I look forward to your help and advice.

Best regards.

Edgar

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Command execution exception for one window only
« Reply #1 on: April 08, 2021, 05:33:55 AM »
You could use a "Begin a Conditional (If Statement) Block" action combined with the "{ACTIVEWINDOWTITLE}" token, to check whether the active window title starts with "Vectorworks Studio", and it not, either perform a different function (by using a "Condition Else" action), or do nothing at all (by enabling the "When this block is reached, exit command if condition is met" option).

E.G.
Code: [Select]
Begin Text Compare : [{ACTIVEWINDOWTITLE}] Starts With 'Vectorworks Studio'
End Condition - Exit when condition met
Scroll mouse wheel forward 1 click
Say, 'UP'  (and wait until it completes)

If you use the option to exit the command, you'd want to apply the same actions to the other command you want to use when another applications is active, by inverting the logic so that it exits when the application is anything but "Vectorworks Studio".

Both commands would still execute, but only one would perform any actions aside from the window title check.

These topics may also be of use in addition to the official documentation:
Control flow (If, Else, ElseIf, Loop, Jump) basics
Variables and tokens summed up


Another option would be to have separate profiles for the applications you're using.
You can enable the "Enable Auto Profile Switching" option on the "General" tab of the VoiceAttack options window, so you can then use the "Enable profile switching for the following windows or processes" option at the profile level to list any windows you want that profile to apply to.

For commands that apply to multiple profiles, you can use the "Include commands from other profiles" option at the profile level, or the "Global Profiles" option on the "General" tab of the VoiceAttack options window, to include command from one or more profiles into the active profile.

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Command execution exception for one window only
« Reply #2 on: April 08, 2021, 05:34:38 AM »
In addition to my question, along the same lines, is it possible to block a specific application for a profile?

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Command execution exception for one window only
« Reply #3 on: April 08, 2021, 05:39:45 AM »
Not as such, no.

Individual commands can use an explicit, action-based check, as shown, and the targeting options can be combined with the "Stop command if target window focus is lost" option so that a command will only execute if one specific target window is available (again at the command level), but there is no method for preventing an active profile from working with any window/application but one.


As mentioned, you can have a separate profile for that one application. You could use a blank profile if you don't want any commands to execute while that application is active (assuming you don't have any global profiles set up)

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Command execution exception for one window only
« Reply #4 on: April 08, 2021, 05:42:03 AM »
Hello Pfeil,
Thank you for your quick reply.
You answered faster than I was able to complete my first question!
I had seen the principle of the execution conditions, but I did not see how to get the window variable.
I will try with your solution.
I've thought about creating different profiles and including the desired applications in them, but I imagined that being able to exclude or blacklist an application from a profile or a command in the same mode would have been easier.
I'm getting to work on testing this.
Have a nice day.
Best regards.
Edgar

E_RAMEL

  • Newbie
  • *
  • Posts: 37
  • 😊 VoiceAttack saves my wrists 👍🏻
    • Landscop design - Paysagistes
Re: Command execution exception for one window only
« Reply #5 on: April 08, 2021, 07:02:53 AM »
Hello again Pfeil,
Tested, it works perfectly with the conditional varible 👍🏻
Great and thanks to you 👏🏻
Best regards.
Edgar