Author Topic: Having a issue with show a window.  (Read 1545 times)

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Having a issue with show a window.
« on: February 17, 2021, 03:24:09 PM »
I have a command that looks to see if a window is running in the background, in this case, Speed Dial - Opera.

If the window is running in the background, Show, should bring it to the foreground, which it does, but then for some strange reason, it snaps back to the previous window I was on. So, I have to hit the command again, to go back to Speed Dial - Opera.

Now, this doesn't happen every time, but it happens quite often. There is nothing in the command that would make it go back to the previous window. There are no keypresses. It just randomly bounces back to the previous window.

It's basically doing a Alt+Tab after it finds Speed Dial - Opera, but there is no key combo in the command that would make up Alt+Tab. The trigger key for the command is F13.

It's just very strange, any ideas what it could be, or what I'm overlooking. I just can't figure it out.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Having a issue with show a window.
« Reply #1 on: February 17, 2021, 03:37:02 PM »
Does this happen with any currently active window (the one that becomes the previous window after switching to Opera), or are you testing with a specific window/application?

Does the task switcher (the row(s) of thumbnails that show when you press Alt-Tab) appear at all when this happens, even for a brief moment?

Are there any other commands that execute when this occurs, according to the log on the main window?

Do you have any other commands that switch to a window of a different application, and does this behavior occur with them as well? I.E. does it appear to be unique to Opera?

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Having a issue with show a window.
« Reply #2 on: February 17, 2021, 06:53:30 PM »
1. I believe it's any current active window.

2. No the task switcher doesn't appear.

3. No, it's just this single command.

4. I don't have another command that uses Show that's triggered by a button at least.

There isn't even a single Alt, or Tab pushed anywhere in the command.

Hmm, maybe I'm doing something wrong with the command, maybe you could help me. It's not really complicated, but clearly, I'm doing something wrong.

What the command is suppose to do is, when triggered, if the active window is Speed Dial - Opera, it does nothing, if it's not Speed Dial - Opera, it looks to see if it's running, and if it finds it, it makes it the active window, and if it's not running, it starts Opera, which starts with Speed Dial - Opera open.

Run application 'C:\Users\Iceblast\AppData\Local\Programs\Opera\launcher.exe'

I've remade this command many times. It will work for awhile, then it starts having issues, and I have to fix it again. Maybe you'll have better luck than me. :)


Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Having a issue with show a window.
« Reply #3 on: February 17, 2021, 06:54:50 PM »
What are the actual contents of the action list of your command?

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Having a issue with show a window.
« Reply #4 on: February 17, 2021, 08:38:40 PM »
I was going over the command again, and realized I wasn't using Show to find Speed Dial - Opera, because VA's show can't find it. I'm using a Autohotkey command to do it.

IFWinExist, Speed Dial - Opera
sleep 300
Winactivate
return

#IfWinActive, Speed Dial - Opera
winmaximize, A
return

Code: [Select]
Begin Text Compare : [{WINDOWTITLEUNDERMOUSE}] Equals 'Speed Dial - Opera'
    Write [Blue] '11' to log
    Display window 'Speed Dial - Opera' as [Show]
    Pause 0.2 seconds
    Press and release Left Ctrl+Left Shift+\ | keys
End Condition - Exit when condition met
Run application 'C:\Running AHK scripts\Speed Dial.ahk'
Pause 0.8 seconds
Begin Text Compare : [{ACTIVEWINDOWTITLE}] Does Not Equal 'Speed Dial - Opera'
    Run application 'C:\Users\Iceblast\AppData\Local\Programs\Opera\launcher.exe'
End Condition
Pause 0.2 seconds
Press and release Left Ctrl+Left Shift+\ | keys

VA apparently sees the active window enough, for the Text Compare, but can't find it with the Show command.

This, Press and release Left Ctrl+Left Shift+\ | keys just puts the Cursor in the address bar in Opera.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Having a issue with show a window.
« Reply #5 on: February 17, 2021, 09:25:17 PM »
"Show" works just fine on my machine for that window, as long as the window isn't minimized, but that's true for other applications as well.
Other options like "Normal", "Maximize", and "Restore" do work when minimized.

If VoiceAttack actually can't find a window for the "Perform a Window Function" action, there would be a log message to notify you of that.


If the issue occurs specifically when a new instance of Opera is launched, that could be a timing issue.
If the keypress to focus the address bar (is that custom? The default shortcut should be Ctrl-L) is sent just before the application has started, it could get sent to the previous application, causing it to regain focus

iceblast

  • Sr. Member
  • ****
  • Posts: 374
Re: Having a issue with show a window.
« Reply #6 on: February 17, 2021, 11:38:21 PM »
Jeez, I found the problem. I had another Show command that had Set command to target this window checked. So when it sent the command to go to the address bar, it would go back to the previous window.

The other problem, Show can't find Speed Dial - Opera

I can make a new command and only put a Display window 'Speed Dial - Opera' as [Show] in it, and have a Speed Dial - Opera running in the background, and push the button all day, and it will never find Speed Dial - Opera.

When you set the windows title for Show to find, it sees Speed Dial - Opera in the list of windows open, yet, it can't find it when you trigger the command. No idea why.

It seems to make any Opera window active, but not Speed Dial - Opera

Yet, AHK command finds it every time, strange.