【问题标题】:Fix Labview Alt-Tab behaviour with Autohotkey使用 Autohotkey 修复 Labview Alt-Tab 行为
【发布时间】:2015-06-01 10:00:53
【问题描述】:

有人尝试修复 Labview 使用 Autohotkey 干扰正常 Alt-Tab 行为的方式吗?

Alt-Tab 在 Labview 中将所有非 Labview 窗口置于列表末尾。

因此,如果您只是从浏览器中通过 alt-tab 键切换到 labview 窗口,则需要

(2 × number_of_currently_open_labview_projects -1)

击键返回。

【问题讨论】:

    标签: autohotkey labview alt-tab


    【解决方案1】:

    好主意。我发现这个功能很烦人,而且在网络上的任何地方似乎都没有一个简单的修复方法。这是我的脚本。两个快速说明:

    • 我在重新映射 Alt-Tab 时遇到了很多麻烦。如果这很关键,您可以尝试启动 here 寻求帮助。
    • 据我所知,无法消除“屏幕闪烁”,因为 Windows 需要在击键之间有一些延迟。

    注意:要使此代码适用于各种 Windows - 使用 AutoHotkey installer 中包含的 Window Spy 工具查找“ahk_class”。

    代码

    #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}
    

    【讨论】:

    • 好的开始!不过,它并没有很好地计算 vis。我打开了一个 vi 文件(即 2 个窗口:FP 和 BD)- 它说我有三个。
    • 应该很容易追踪 - 只需运行 WinGet 并查看那里有什么。我通过在窗口标题中查找 vi 来计算,但如果您有其他内容出现,可以修改代码。 autohotkey.com/docs/commands/WinGet.htm
    • 在我的实验中,ahk_class LVDChild 被证明足够可靠
    【解决方案2】:

    我最近发现了一个与此问题相关的article,但不幸的是它是俄语的。

    它使用 python 脚本(+autohotkey 映射)引用了以下blog,似乎可以在没有“屏幕闪烁”的情况下解决问题。

    【讨论】:

      猜你喜欢
      • 2011-06-14
      • 2020-06-30
      • 1970-01-01
      • 2018-07-17
      • 1970-01-01
      • 1970-01-01
      • 2020-04-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多