这看起来似乎是一个明显的答案,但我有一个AHK脚本,当我按下指定的键时可以工作,但我想知道当我双击脚本图标时有没有办法触发脚本?
目前,当我双击.ahk文件时,它只会在我的系统托盘中打开并闲置,直到我按下该键。
答案 0 :(得分:1)
默认,MenuItemName:将菜单的默认项目更改为MenuItemName,并使该项目的字体变为粗体。当用户双击托盘图标时,将启动其默认菜单项。 https://autohotkey.com/docs/commands/Menu.htm#Add_or_Change_Items_in_a_Menu
; auto-execute section
Menu, TRAY, Add
Menu, Tray, Add, run Notepad (Double Click), run_Notepad
; Menu, Tray, Icon, run Notepad (Double Click), %A_WinDir%\Notepad.exe
Menu, TRAY, Default, run notepad (Double Click)
return ; end auto-execute section
run_Notepad:
F1::
Run notepad
return
编辑:抱歉,我误解了你的问题。
双击脚本图标或按F1运行编辑器:
; auto-execute section:
#NoEnv
#SingleInstance force
GoSub, run_Notepad
return ; end auto-execute section
run_Notepad:
F1::
Run notepad
return