The relevant part is:
The last parameter: Specify 1 for the last parameter to freeze the icon, or 0 to unfreeze it (or leave it blank to keep the frozen/unfrozen state unchanged). When the icon has been frozen, Pause and Suspend will not change it. Note: To freeze the current icon, use Menu, Tray, Icon,,, 1 ; (or 0 to unfreeze)
...but you also need to be able to detect when the script is paused/suspended.
; Call WM_COMMAND() whenever the WM_COMMAND (0x111) message is received.
OnMessage(0x111, "WM_COMMAND")
;...
WM_COMMAND(wParam, lParam)
{
static IsPaused, IsSuspended
Critical
SetFormat, Integer, D ; to be sure (since if..in compares alphabetically)
id := wParam & 0xFFFF
if id in 65305,65404,65306,65403
{ ; "Suspend Hotkeys" or "Pause Script"
if id in 65306,65403 ; pause
IsPaused := ! IsPaused
else ; at this point, A_IsSuspended has not yet been toggled.
IsSuspended := ! A_IsSuspended
; INSERT CODE HERE to set icon based on IsPaused and/or IsSuspended
}
}
Note: IsPaused will go out of sync if the "Pause" command is used from script, unless you also call
WM_COMMAND(65306,0).
Update (July 15, 2009): As of v1.0.48, you may use the built-in variable A_IsPaused.