Fix Labview Alt-Tab behaviour with Autohotkey

402 Views Asked by At

Did anyone try to fix the way Labview interferes with normal Alt-Tab behaviour using Autohotkey?

Alt-Tab inside Labview puts all non-labview windows to the end of the list.

So if you have just alt-tabbed to labview window from your browser it takes

(2 × number_of_currently_open_labview_projects -1)

keystrokes to get back.

2

There are 2 best solutions below

3
On

Great idea. I find that functionality annoying and there doesn't appear to be an easy fix anywhere on the web. Here's my script. Two quick notes:

  • I had a lot of trouble re-mapping Alt-Tab. If that's critical you can try starting here for help.
  • To my knowledge it's not possible to get rid of the "screen flicker" because Windows requires some delay between keystrokes.

Note: to adapt this code for various Windows - look up the "ahk_class" using the Window Spy tool included in the AutoHotkey installer .

Code

#NoEnv  ; Recommended for performance and compatibility with future 
AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#NoTrayIcon 
#SingleInstance force

SetTitleMatchMode 2 ;partial search mode
#IfWinActive vi
#q:: ;there were issues mapping to Alt+Tab

CountOfVIs := -1
WinGet, id, list,ahk_class LVDChild,, Program Manager
Loop, %id%
{
CountOfVIs := CountOfVIs +1
}

msgbox, # of VIs open: %CountOfVIs% ;when I remove this it doesn't work - must be an AHK thing

Send {Alt down}
Loop,%CountOfVIs%
{
Send {tab}
Sleep,50 ;if this is too low it doesn't work
} 
Send {Alt up}
0
On

I've recently found an article related to this problem, but unfortunately it is in Russian.

It references the following blog with a python script (+autohotkey mapping) that seems to be solving the problem without the "screen flicker".