【问题标题】:AHK Always on Top not working for Windows File Explorer and other Windows system windows?AHK Always on Top 不适用于 Windows 文件资源管理器和其他 Windows 系统窗口?
【发布时间】:2022-01-21 08:55:06
【问题描述】:

我一直在使用 Alwaysontop AHK 脚本将我的窗口保持在其他窗口之上。

这是有问题的代码:

^SPACE:: Winset, Alwaysontop, , A ; ctrl + space
Return
~#!x::Suspend

它几乎适用于我使用的几乎每个窗口,除了基于 Windows 的窗口——比如文件资源管理器、任务管理器等......

我怎样才能让这些窗口也与脚本一起使用?

我以前使用过 WinSpy 来获取有关特定 Windows 事物的信息,但我不确定在这里寻找什么,或者是否有更简单的解决方案可以强制基于 Windows 的窗口与脚本一起运行。

有什么想法吗?

【问题讨论】:

  • 在这里工作正常。这是整个剧本吗?
  • 这就是整个脚本。它是否适用于您的任务管理器之类的东西?也许我有一些冲突的软件,但我已经尝试关闭我拥有的大多数应用程序,但仍然没有。虽然适用于记事本之类的东西,但不适用于任务管理器和文件资源管理器窗口(以及类似的窗口)。
  • 尝试在顶部添加#UseHook
  • 刚刚测试过,但似乎没有任何改变。

标签: windows autohotkey explorer hotkeys


【解决方案1】:

AHK 不会拦截以提升权限运行的程序中的按键,除非脚本本身以这种方式运行:

#UseHook

; If the script is not elevated, relaunch as administrator and kill current instance:

full_command_line := DllCall("GetCommandLine", "str")

if not (A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)"))
{
    try ; leads to having the script re-launching itself as administrator
    {
        if A_IsCompiled
            Run *RunAs "%A_ScriptFullPath%" /restart
        else
            Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
    }
    ExitApp
}

            RETURN   ; === end of auto-execute section ===

; ctrl + space:
^SPACE:: Winset, Alwaysontop, , A

~#!x::Suspend

更多详情请阅读https://autohotkey.com/docs/commands/Run.htm#RunAs

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-01-28
    • 2016-04-17
    • 2018-07-28
    • 2010-09-21
    • 1970-01-01
    • 2023-03-14
    • 2012-05-02
    相关资源
    最近更新 更多