11-01-2016, 07:09 PM
Exits the rep loop when the tray icon left-clicked. The test window here is a Notepad message box.
Macro Macro274
Or Ctrl+click the tray icon to end the macro. Then don't need all this, just use your first posted macro without changes.
Macro Macro274
str Icon = "$qm$\paste.ico"
int count = 0
str s = 0
int stop
Tray t.AddIcon(Icon "0" 0 &sub.Callback_Tray_AddIcon)
rep
,0.1
,if(stop) break
,int w1=win("Notepad" "#32770")
,if(w1=0) continue
,clo w1
,count + 1
,s = count
,t.AddIcon(Icon s)
#sub Callback_Tray_AddIcon v
function Tray&x message
;Callback function for Tray.AddIcon.
;Called for each received message - when tray icon clicked, or mouse moved.
;x - reference to this object.
;message - mouse message (WM_MOUSEMOVE, WM_LBUTTONDOWN, etc).
;OutWinMsg message 0 0 ;;uncomment to see received messages
sel message
,case WM_LBUTTONUP
,out "left click"
,;out x.param
,
,;exit the above rep loop
,stop=1
,
,case WM_RBUTTONUP
,out "right click"
,
,case WM_MBUTTONUP
,out "middle click"
,Or Ctrl+click the tray icon to end the macro. Then don't need all this, just use your first posted macro without changes.
