热键重新启动自动热键脚本? [英] Hotkey to restart autohotkey script?

查看:35
本文介绍了热键重新启动自动热键脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个自动热键脚本 C:path omyscript 正在运行.有没有办法定义一个重新启动它的热键?

Say I have an autohotkey script C:path omyscript running. Is there a way to define a hotkey that re-starts it?

推荐答案

为了防止重复实例,我一般不会重新启动脚本而是使用内置函数 重新加载.我用 Ctrl+Win+Alt+R 启动它并使用 Ctrl+Win+Alt+E 编辑主 AHK 脚本.

In order to prevent duplicate instances, I normally do not re-launch a script but use the build-in function Reload. I launch this with Ctrl+Win+Alt+R and use Ctrl+Win+Alt+E to edit the main AHK script.

^#!r::Reload

实际上,我的脚本是这样的:

Actually, my script looks like this:

^#!r::
Send, ^s ; To save a changed script
Sleep, 300 ; give it time to save the script
Reload
Return

^!#e::Edit

事实上,在我的脚本顶部,我一直在用这个给我一个视觉和音频指示,表明脚本已重新启动:

As a matter of fact, all the way at the top of my script I have this to give me a visual and audio indication that the script was restarted:

#SingleInstance Force
#installKeybdHook
#Persistent
Menu, Tray, Icon , Shell32.dll, 25, 1
TrayTip, AutoHotKey, Started, 1
SoundBeep, 300, 150
Return

这篇关于热键重新启动自动热键脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆