Can the language be change
Posted: 28 Mar 2024, 02:07
I want to compile a script for my colleagues use, but some of them know little about English, so can the language be change?
Let's help each other out
https://www.autohotkey.com/boards/
https://www.autohotkey.com/boards/viewtopic.php?f=82&t=127944
Code: Select all
/*
Please refer to the better code below.
*/
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance
persistent
onMessage(0x0404,AHK_NOTIFYICON)
customMenu:=menu()
customMenu.add("&AutoHotkey 论坛链接",runAutoHotkeyForumLink)
customMenu.add("程序关闭(&X)",(*)=>ExitApp())
AHK_NOTIFYICON(wParam, lParam, Msg, hWnd) {
switch (lParam)
{
case 0x0205: ; RButton Up
setTimer notifyIconRbuttonUp, -1
return true
}
}
notifyIconRbuttonUp() {
customMenu.show()
}
runAutoHotkeyForumLink(itemName, itemPos, myMenu) {
try run("https://www.autohotkey.com/boards/")
}
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance
persistent
onMessage(0x0404,AHK_NOTIFYICON)
if (!A_IsCompiled) {
A_TrayMenu.rename("&Help", "帮助(&H)")
A_TrayMenu.rename("&Window Spy", "应用程序窗口监视器(&W)")
A_TrayMenu.rename("&Reload Script", "重新加载程序(&R)")
A_TrayMenu.rename("&Edit Script", "编辑程序(&E)")
}
A_TrayMenu.rename("&Suspend Hotkeys", "暂停热键(&S)")
A_TrayMenu.rename("&Pause Script", "暂停程序(&P)")
A_TrayMenu.rename("E&xit", "退出(&X)")
AHK_NOTIFYICON(wParam, lParam, Msg, hWnd) {
switch (lParam)
{
case 0x0205: ; RButton Up
setTimer notifyIconRbuttonUp, -1
return true
}
}
notifyIconRbuttonUp() {
try A_TrayMenu.rename("&Open", "打开(&O)")
A_TrayMenu.show()
}
; F5::A_AllowMainWindow:=!A_AllowMainWindow
It might be helpful to someone, but I think it just distracts from the actual answer to the original question (which you did include in your example, so don't take my criticism harshly). boiler did not mention replacing the tray menu, but modifying it; replacing the items within A_TrayMenu. You can just remove all of the standard items and add your own, without ever needing to use OnMessage.
Code: Select all
#Requires AutoHotkey v2.0
#SingleInstance
persistent
A_TrayMenu.delete()
A_TrayMenu.add("&AutoHotkey 论坛链接",runAutoHotkeyForumLink)
A_TrayMenu.add("程序关闭(&X)",(*)=>ExitApp())
runAutoHotkeyForumLink(itemName, itemPos, myMenu) {
try run("https://www.autohotkey.com/boards/")
}
非常感激您的帮助Seven0528 wrote: ↑28 Mar 2024, 19:46@songdg
The image you provided shows the WeChat icon in the system tray.
It seems you might be Chinese, so I've rewritten it in Chinese. Hope that helps.
看您提供的图片,托盘图标中有微信。
看起来您可能是中国人,我尝试重新用中文写了一遍。希望有所帮助。Code: Select all
#Requires AutoHotkey v2.0 #SingleInstance persistent onMessage(0x0404,AHK_NOTIFYICON) if (!A_IsCompiled) { A_TrayMenu.rename("&Help", "帮助(&H)") A_TrayMenu.rename("&Window Spy", "应用程序窗口监视器(&W)") A_TrayMenu.rename("&Reload Script", "重新加载程序(&R)") A_TrayMenu.rename("&Edit Script", "编辑程序(&E)") } A_TrayMenu.rename("&Suspend Hotkeys", "暂停热键(&S)") A_TrayMenu.rename("&Pause Script", "暂停程序(&P)") A_TrayMenu.rename("E&xit", "退出(&X)") AHK_NOTIFYICON(wParam, lParam, Msg, hWnd) { switch (lParam) { case 0x0205: ; RButton Up setTimer notifyIconRbuttonUp, -1 return true } } notifyIconRbuttonUp() { try A_TrayMenu.rename("&Open", "打开(&O)") A_TrayMenu.show() } ; F5::A_AllowMainWindow:=!A_AllowMainWindow
Thank you very much indeedboiler wrote: ↑28 Mar 2024, 02:22You can remove the existing tray menu items using A_TrayMenu.Delete and add your own menu items using any language. If you want it to do those same things, then you would just need to add your own functions that do those same things that those menu items would invoke.