如何使用autohotkey快速分配键盘快捷键以启动您喜欢的应用程序


2

在Windows(XP,7,8)中,当应用程序处于活动状态时,如何使用autohotkey快速分配键盘快捷键以启动您喜欢的应用程序。

在键盘实用程序中,只需按一下热键即可启动您喜欢的应用程序以便快速访问。

如果可以使用autohotkey完成,我还在徘徊。

编辑:

通常要添加一个脚本Ctrl+Alt+N按下时,将启动记事本。您需要具有以下脚本。

^!n ::运行记事本

我想要的是,当应用程序处于活动状态时,按下Ctrl + Shift + A应该采用安装应用程序的路径并创建如上所述的脚本。

因此,当命令提示符处于活动状态时,按下Ctrl + Shift + A 应创建如下所示的脚本。

^!t ::运行C:\ WINDOWS \ system32 \ cmd.exe

其中C:\窗口\ system32 \ cmd.exe的路径,其中CMD安装/位于

并且 Ctrl + Shift + T是键盘快捷键。


是的,它是windows(XP,7,8)
Ishan

添加到问题;)
埃弗雷特

Answers:


1

这不是你可以轻易做到的事情。

您可以执行以下操作:https//stackoverflow.com/questions/12851677/dynamically-create-autohotkey-hotkey-to-function-subroutine

或者您可以在运行时修改文件并重新加载它。

#SingleInstance Force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^!n::
    WinGet, pn, ProcessName, A
    path := GetProcessPath(pn)
    tooltip, press a new hotkey
    Input, new_hotkey, L1
    tooltip,

    code = ^!%new_hotkey%`:`:Run, %path%`n
    FileAppend, %code%, %A_ScriptFullPath%

    Reload
    Sleep 1000 ; If successful, the reload will close this instance during the Sleep, so the line below will never be reached.
    MsgBox, 4,, The script could not be reloaded. Would you like to open it for editing?
    IfMsgBox, Yes, Edit
    return


GetProcessPath(exe) {
    ;;http://www.autohotkey.com/board/topic/32965-getting-file-path-of-a-running-process/
    for process in ComObjGet("winmgmts:").ExecQuery("Select * from Win32_Process where name ='" exe "'")
        return process.ExecutablePath
}

return

Hotkeys:
^!f::Run, C:\Program Files\Mozilla Firefox\firefox.exe

0

是的你可以。以下示例将在按下Win + 0时启动资源管理器(#表示AHK中的Window键):

#0::Run C:\Windows\System32\explorer.exe

如果应用程序因为已经运行而未启动,则可以创建一个包含以下内容的批处理文件:

start program.exe

并告诉AHK脚本启动该批处理文件。


我已经知道如何做到这一点,但这不是我追求的。您的解决方案需要实际找到应用程序路径,然后从中创建键盘快捷方式。请查看youtube.com/watch?v=GzcQbrkdvJU&feature=player_embedded, 以说明我使用的是autohotkey而不是视频使用的PhraseExpander。
Ishan

那么你是在GUI之后创建快捷方式分配?
Suchipi

0

为了快速指定键盘快捷键以启动我喜欢的应用程序,我创建了一个易于使用和配置的AutoHotkey脚本,允许打开,最小化或恢复窗口应用程序,Chrome应用程序或Chrome快捷方式。它还有一些其他功能,如错误捕获等..代码在这里:https//github.com/JuanmaMenendez/AutoHotkey-script-Open-Show-Apps

配置示例

F7:: OpenOrShowAppBasedOnExeName("C:\Windows\System32\SnippingTool.exe")

F8:: OpenOrShowAppBasedOnWindowTitle("Gmail", "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --app=https://mail.google.com/mail/")

我希望你发现它有用;)💁♂️⭐

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.