Author Topic: how to close the window ? ... "Unable to acquire window or process for window fu  (Read 4443 times)

FaschingsPrinz

  • Guest
Hello,

I use a voice command do open a picture/foto.
I do this by using: Run aplication 'path of picture'

Afterwards I pause shortly.

And then I want the picture/foto to be closed again.
I do this by "perform a window function".
Window Title:  [Active Window]
and choosing "Close Window" beneath it.

If I do so, I always get the message by VoiceAttack:  "Unable to acquire window or process for window function"

If I change the Window Title to the name of the opened foto (from the pulldown menu) I get the same error.

What is the reason for it that I cant close the active window ?

Thanx a lot in advance

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Works fine in Windows 7, but I can reproduce this on my Windows 10 VM; Perhaps it's because the "Photos" app is an UWP application, rather than a traditional Winforms one.

Closest I could get is to close the entire app by killing the "Microsoft.Photos" process using the "Stop a Process by Name" action.

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Can you just use CTRL+F4 to close the program. It's usually the way I close windows with VA.

FaschingsPrinz

  • Guest
The problem with CTRL F4 is, that it "shoots down the program" so to say.
If something has been changed in the program (word, excel,..) then CTRL F4 closes the window never the less, not asking if it should save the changes before closing, which is not conveniant.

Something is not working with the active window.
For example I cant switch to VoiceAttack too.
If I want to edit my profile via a voice-command Im not able to.
The procedure from the manual with uses switching to a not active window (in my case VoiceAttack) by using "Perform a window function" and then choose: Window Title  "VoiceAttack" and choosing "Display" & "Normal" and checking the  hook at "Set command to target this window" seams not to work.
If I use CTRL-E afterwards (=edit profile) it does onlywork when VoiceAttack has been active before; but if another program is active .. it does not switch.

If I write the active window to the protocol via {ACTIVEWINDOWPROCESSNAME} it shows the name of the active window, and NOT the VoiceAttack-Window, which it should since "Set command to target this window" was checked.

Any ideas ?

« Last Edit: January 07, 2018, 09:29:22 AM by FaschingsPrinz »

Gangrel

  • Caffeine Fulled Mod
  • Global Moderator
  • Full Member
  • *****
  • Posts: 216
  • BORK FNORK BORD
Alt+F4 is the normal "quick, shut down the window" button combination, not CTRL F4

iceblast

  • Sr. Member
  • ****
  • Posts: 374
You're right about CTRL+F4, I tend to use it to close browser windows. I meant ALT+F4.

When I use ALT+F4 while using Microsoft Office, it does ask me if I would like to save the file first. Now, if you end the process, that will just kill the program. ALT+F4 should act like hitting the X to close.

A lot of times, the reason Active Window doesn't work, is because you have the title of the window wrong in some way.

Also, if you're trying to display the window, try using SHOW instead, I find that works, while NORMAL may work, but could screw with the window if it's Maximized, which is irritating.

I made a command that you trigger by voice. Called - Windows Title.

Code: [Select]
Set Windows clipboard to '{WINDOWTITLEUNDERMOUSE}'
Write '[Blue] {WINDOWPROCESSUNDERMOUSE} <<< The Exe' to log
Write '[Blue] {WINDOWTITLEUNDERMOUSE} <<< The Windows Title' to log

It will copy the windows title to the clipboard for you, and tell you in the log what the Process name is and windows title is under the mouse cursor. You'll be surprised how the title changes while your in a menu of a program. I was in a program just a couple of days ago, that the title changed to "Analyze" just because where I was trying to paste data. I spent 30mins trying to figure out why the program wasn't working. Didn't make any sense, till I double check the windows title.

This command is also very handle for finding the windows title for different parts of VA if you try to make some commands to add commands to VA with your voice.

I have one that will save the mouse data location of where the mouse is, and when I go back to the command in VA, have it automatically add the mouse point data to my command for me. I love it.

Hope some of this might help! :)

FaschingsPrinz

  • Guest
Hello fiends,
thanx for your help.
I found the reason for my particular problem - not being able to reach VoiceAttacks own window.

On the main-window of VoiceAttack, under Settings/Options, General, .. I had "Minimize to System Tray" ticked.
Somehow this made it impossible to reach VoiceAttacks own window.
I un-ticked this option .. and it works now.
Strange but true.
Something to keep in mind.
« Last Edit: January 07, 2018, 12:57:35 PM by FaschingsPrinz »

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
When minimizing to tray, the VoiceAttack window's reference is no longer available, so there's no window to switch to.

This is a normal consequence of the way Window's window management works.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Based on some of my conversation with Gary and my own testing it IS possible to get the window handle when VA is set to "minimize to tray," but it isn't super easy. Gary did mention it might not be too much trouble to better expose the VA window handle which would make performing window functions with a minimized-to-tray VA easier.