0

以下代码在 Windows Vista 和 Windows 7 上运行良好,但是当我尝试在 Windows Server 2008 R2 上运行它时,它会不断在我的系统托盘中生成越来越多的相同脚本实例,直到 AutoHotKey 最终锁定我的整个系统。似乎 AutoHotKey 的“标签”功能是罪魁祸首。有谁知道解决方法?

phpDoc:
SendInput <{?}php{Enter}{Enter}{?}>{Enter}
SendInput {Up 2}
return

html5:
SendInput <{!}doctype html>{enter}
SendInput <html>{enter}
SendInput <head>{enter}
SendInput <title></title>{enter}
SendInput <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">{enter}
SendInput <meta http-equiv="Pragma" content="no-cache">{enter}
SendInput <meta http-equiv="Cache-Control" content="no-cache">{enter}
SendInput <meta name="Expires" content="Mon, 01 Jan 2000 00:00:01 GMT ">{enter}
SendInput <link rel="stylesheet" type="text/css" href="/styles.css">{enter}
SendInput </head>{enter}
SendInput <body>{enter}
SendInput </body>{enter}
SendInput </html>{enter}
SendInput {up 2}
SendInput {end}
return

showMainMenus()
{
    Menu, MySubMenu, add, &1 - PHP, phpDoc
    Menu, MySubMenu, add, &2 - HTML 5, html5
    Menu, MyMenu, add, &1 - Boilerplate Text, :MySubMenu
}

;;;; KEY BINDINGS

!/::
showMainMenus()
return
4

2 回答 2

1

使用#SingleInstance,忽略

将使旧实例保持运行并阻止启动同一脚本的新实例。

于 2013-02-14T14:31:37.640 回答
1

我重写了一点。据我所知,您首先定义菜单结构,然后显示菜单。另外由于Return之前没有phpDoc:,这部分脚本在启动时立即执行....

#SingleInstance, Ignore

;;;; DEFINE MENUS
Menu, MySubMenu, add, &1 - PHP, phpDoc
Menu, MySubMenu, add, &2 - HTML 5, html5

;;;; LAUNCH MENU
!/::Menu, MySubMenu, Show

return ; To prevent phpDoc from executing on startup

phpDoc:
SendInput <{?}php{Enter}{Enter}{?}>{Enter}
SendInput {Up 2}
Return

html5:
SendInput <{!}doctype html>{enter}
SendInput <html>{enter}
SendInput <head>{enter}
SendInput <title></title>{enter}
SendInput <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">{enter}
SendInput <meta http-equiv="Pragma" content="no-cache">{enter}
SendInput <meta http-equiv="Cache-Control" content="no-cache">{enter}
SendInput <meta name="Expires" content="Mon, 01 Jan 2000 00:00:01 GMT ">{enter}
SendInput <link rel="stylesheet" type="text/css" href="/styles.css">{enter}
SendInput </head>{enter}
SendInput <body>{enter}
SendInput </body>{enter}
SendInput </html>{enter}
SendInput {up 2}
SendInput {end}
return
于 2013-02-14T16:03:01.150 回答