Author Topic: Minimize & Restore VA Command with "Minimize to System Tray" Enabled  (Read 5764 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Hello!

I've been trying to find a way to get the VA main window to show/hide when commanded. I can use the "Perform a Window Function - Minimize" and "Perform a Window Function - Normal" and get the correct effect only if the global option "Minimize to System Tray" is disabled.

Here is the command I'm using (executed when I press keys: Left Ctrl+Left Shift+Num Sub)
Code: [Select]
Set Boolean [show voiceattack] to Toggle
Begin Boolean Compare : [show voiceattack] Equals True
    Display window 'VoiceAttack' as [Normal]
Else If Boolean Compare : [show voiceattack] Equals False
    Display window 'VoiceAttack' as [Minimize]
Else
    Set Boolean [show voiceattack] to False
    Jump: Command Start
End Condition

And for good measure I've attached a snapshot of the VA command.

Neither the Minimize or Normal options work when I've enabled "Minimize to System Tray." I've tried all the different Window Function options with no success.

Is it possible by any means to show/hide VA with a command when the "Minimize to System Tray" option is enabled?

Thanks!!
« Last Edit: November 21, 2016, 11:50:25 AM by Exergist »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4747
  • RTFM
Re: Minimize & Restore VA Command with "Minimize to System Tray" Enabled
« Reply #1 on: November 21, 2016, 02:07:02 PM »
This is a Windows limitation. When minimizing to tray, the application window ceases to exist, so there is no window to restore or display.

It would likely require a custom action that internally triggers restoring from the system tray, specific to VoiceAttack.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Minimize & Restore VA Command with "Minimize to System Tray" Enabled
« Reply #2 on: November 21, 2016, 02:10:01 PM »
Thanks for the insight Pfeil!

I figured that was the case, though I wasn't certain. I will probably poke around the documentation for NirCMD to see if I can make a workaround.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Minimize & Restore VA Command with "Minimize to System Tray" Enabled
« Reply #3 on: November 21, 2016, 03:08:23 PM »
Sadly no joy so far with NirCMD. Though I think a decent enough fix will be to always show the VA icon in the system tray and then use the mouse position and send-click commands to get the VA main screen to appear and disappear. I'll post my method when I get around to writing it.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Minimize & Restore VA Command with "Minimize to System Tray" Enabled
« Reply #4 on: January 26, 2017, 10:27:23 AM »
Task Manager is another application that can be set to "minimize to tray." I can get it to unminimize (normal sized window) via the following:

Code: [Select]
Run application 'C:\Windows\System32\taskmgr.exe'
...however performing the same method for VA does not show the window when VA is minimized to tray.

Code: [Select]
Run application 'C:\...\VoiceAttack\VoiceAttack.exe' has no effect

So either Task Manager's "minimize to tray" option behaves differently than VA's, or something else is going on that prevents VA from reappearing with the above command.


I also noticed that the {WINDOWEXISTS:textVariable} token produces different results when comparing Windows Task Manager and VA when they're both set to "minimize to tray."

Code: [Select]
//Define the window title of interest
Set Text [subject window] to 'VoiceAttack'
//Check for 'subject window' in the current open windows and store result
Set integer [window exists] value to the converted value of {WINDOWEXISTS:subject window}
Write '[Blue] {INT:window exists}' to log
The above produces '0' when VoiceAttack is minimized or unminimized, while Task Manager (change above variable 'subject window' to "Windows Task Manager") produces '0' when minimized and '1' when unminimized.

So when VA is set to "minimize to tray" it looks like the program can't even tell that it "exists" regardless of window status...which is strange.

I've also tried to use the program "RBTray" with VoiceAttack, but RBTray doesn't have an effect on it.

I brought this up again because my "workaround" for making VA use mouse position and send-clicks to get VA unminimized from the tray won't work when I'm not able to view the tray (like in any game).

Thoughts?
« Last Edit: January 26, 2017, 10:43:27 AM by Exergist »

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Minimize & Restore VA Command with "Minimize to System Tray" Enabled
« Reply #5 on: January 27, 2017, 11:15:37 AM »
I posted my workaround for showing/hiding VA when it is allowed to "minimize to tray" here

http://voiceattack.com/smf/index.php?topic=841.0

The profile still doesn't address the issue that while in-game the tray will not be visible to show VA, but the user can at least interact with the VA window better on the desktop.

Does the community have any thoughts about my above observations? It would be great if we could work out a way to show/hide VA regardless of tray minimization status.

Cheers!