Author Topic: Target VA itself?  (Read 506 times)

Atomos

  • Newbie
  • *
  • Posts: 2
Target VA itself?
« on: May 31, 2024, 09:07:07 AM »
Hey everyone,

A quick question I haven't been able to find the answer to - Is it possible to target VoiceAttack itself for window operations? For example, I think it would be nifty to hide/show VoiceAttacks mainscreen/log(?) by just saying 'Voiceattack'. Otherwise I have the program minimized to systemtray.

I have the impression it's not possible, but perhaps you know better?

Thanks in advance and thanks for a great application and the all the helpful support on this forum.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Target VA itself?
« Reply #1 on: May 31, 2024, 09:27:27 AM »
That is possible, however because minimizing to the system tray doesn't exist within Windows as a feature, but instead is "faked" by hiding the window and showing a system tray icon, the application window won't be available.

VoiceAttack can work around this for itself (because it has the information on its own window internally).

This can be done using a (C#) inline function:
Code: [Select]
public class VAInline
{
public void main()
{
VA.Utility.RestoreUI();
}
}

Minimizing should be possible using the normal "Perform a Window Function" action, however it can also be done by calling the "MinimizeUI()" method (I.E. rather than the "RestoreUI()" method, other that that the inline function would be identical)


There is no native method for checking that state, or toggling it directly, as far as I'm aware, so you'd need two commands.

Atomos

  • Newbie
  • *
  • Posts: 2
Re: Target VA itself?
« Reply #2 on: June 01, 2024, 06:20:28 AM »
Thank you very much, worked perfectly!

I got it working with one command.

Code: [Select]
Boolean compare = False (Undefined set as false)
Inline C#: RestoreUI
Set boolean = True

ELSE
Inline C#: MinimizeUI
Set boolean = False
END

I just made it and tested it a few times, you can of course 'break' it by manually restoring/minimizing and thus mismatching the boolean state, but that just means you have to repeat yourself once.