Way to Disable Button if Application not Focused?

Questions, comments, and suggestions related to Typeitin.
Post Reply
Chris
Posts: 7
Joined: Mon Jul 05, 2021 7:26 pm

Way to Disable Button if Application not Focused?

Post by Chris » Wed Jul 28, 2021 3:22 am

I have been setting up my F Keys as shortcut keys. However, I'm running out.

I'm trying to figure out a way to disable buttons if the window isn't in focus.

For instance, if I have F1 set has a shortcut for chrome and also for Avaya Agent, it would only work if the application is in focus. For instance if I'm working in chrome, all my buttons on Avaya would be disabled.

Is there a way to do this?

Wavget
Site Admin
Posts: 91
Joined: Wed Jan 16, 2019 4:32 pm

Re: Way to Disable Button if Application not Focused?

Post by Wavget » Wed Aug 18, 2021 3:22 pm

It is currently not possible to change the shortcut key assignments based on the active application.

However, it is possible to change the activity of a button based on the active application.

Use the {Var1 Application} function to get the name of the active application.

You can use {Var1 Application}{Dialog 0,Information,[Ok],{Var1}} as a test to find and display the application name.

You can then use the If function to select the activity of the button {If (Var1=chrome.exe) [chrome action]}{If (Var1=avaya.exe) [Avaya action]}

Putting it all together:
{Var1 Application}{If (Var1=chrome.exe) [chrome action]}{If (Var1=avaya.exe) [Avaya action]}

Replace chrome action and Avaya action with the functions you require.
Also, the avaya.exe is just a guess, you will have to use the dialog function above to find out the real name.

Post Reply