I 've seen in some documentation that you can't toggle the pause and suspend key anymore in v2
Is there an woraround for this ?
I have an tray-menu where there are some functionalities but when i press "Pause" or CTRL + esc i want to suspend and pause my script and change the tray-icon to the suspend-icon
if i press pause or ctrl+esc again the script should be unpaused and unsuspended
Code works in v1
Code: Select all
Menu, tray, add, &Afsluiten`tSHIFT + ESC, EVENT_BTNSluiten
Menu, tray, add, Her&laden`tCTRL + SHIFT + ESC, EVENT_BTNHerladen
Menu, tray, add, Sus&pend`tCTRL + ESC / PAUSE, EVENT_Suspend
^ESC:: ; CTRL + ESC
Pause:: ; PAUSE
EVENT_Suspend:
Suspend
Pause, , 1
if A_IsSuspended = 1
Menu, Tray, Icon, Sus&pend`tCTRL + ESC / PAUSE, %A_AhkPath%, 5 ; suspend icon
Else
Menu, Tray, NoIcon, Sus&pend`tCTRL + ESC / PAUSE,
return
Code: Select all
tray:= A_TrayMenu
tray.add("&Afsluiten`tSHIFT + ESC", EVENT_BTNSluiten)
tray.add("Her&laden`tCTRL + SHIFT + ESC", EVENT_BTNHerladen)
tray.add("Sus&pend`tCTRL + ESC / PAUSE", EVENT_Suspend)
^ESC:: ; CTRL + ESC
Pause:: ; PAUSE
EVENT_Suspend(A_ThisMenuItem, A_ThisMenuItemPos, MyMenu)
{ ; V1toV2: Added bracket
Suspend()
Pause()
if (A_IsSuspended = 1)
Tray.Icon("Sus&pend`tCTRL + ESC / PAUSE", A_AhkPath, "5") ; suspend icon
Else
Tray.NoIcon("Sus&pend`tCTRL + ESC / PAUSE")
return
}