Skip to content

Instantly share code, notes, and snippets.

@tmplinshi
Last active August 29, 2015 14:17
Show Gist options
  • Save tmplinshi/26820a9846fa5d5d8a8d to your computer and use it in GitHub Desktop.
Save tmplinshi/26820a9846fa5d5d8a8d to your computer and use it in GitHub Desktop.
; TrayMenu.ahk
; AHK 版本: 1.1.20.00+
TrayMenu() {
static Init := %A_ThisFunc%()
static winTitle := "ahk_pid " DllCall("GetCurrentProcessId")
If (A_ThisMenuItem = "显示/隐藏窗口") {
If WinExist(winTitle) {
winTitle := "ahk_id " WinExist()
WinHide, % winTitle
}
Else
WinShow, % winTitle
}
Else If (A_ThisMenuItem = "退出")
ExitApp
Else If !A_ThisMenuItem {
Menu, Tray, NoStandard
Menu, Tray, Add, 显示/隐藏窗口, TrayMenu
Menu, Tray, Add, 退出, TrayMenu
Menu, Tray, Default, 显示/隐藏窗口
Menu, Tray, Click, 1
Return True
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment