Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
#DefineFunction SysTraySetup(title, iconfile) IntControl(12,1,'',0,0) ; Allow Windows to be exited with no warning. IntControl(54,'',1,0,0) ; Keep window on top iconfile = StrCat(FilePath(IntControl(1004, 0, 0, 0, 0)),iconfile) rtv = 0 rtv = IntControl(1007,1,1,title,iconfile) ; Add currently-running script to the system tray #EndFunction #DefineFunction SysTraySuspend(title, mgmtpw) rtq = IntControl( 38, -1, '', 0, 0) ;-- return quiet mode setting IntControl( 38, 1, '', 0, 0) ;-- enable quiet mode While @TRUE rtv = IntControl(1007,3,0,title,'') ; Suspend script until user clicks on the tray icon If rtv > 0 Then Break EndWhile IntControl( 38, rtq, '', 0, 0) ;-- restore quiet mode If rtv == 2 IntControl(72,2,0,0,0) answer = AskYesNo(title,'Terminate program ?') If answer == @YES rtv = AskPassword (title, 'Geef wachtwoord') If rtv == mgmtpw rtv = IntControl(1007,2,2,title,'') ; Remove currently-running script from the system tray Exit EndIf EndIf EndIf Return #EndFunction SysTraySetup('title','') While @TRUE Message('hello','there') SysTraySuspend('title','master') EndWhile Exit
You could try creating a click detection loop with a short delay instead of having the IntControl suspend the script
;This intcontrol puts script in systray and hides icon on taskbar IntControl(1007, 1, 1, "YooHoo", "") While 1 ;This intcontrol suspends the script until user clicks on the tray icon clicktype = IntControl(1007, 0, 0, 0, 0) ;;;;;;;;; does not suspend script Switch clicktype Case 1 Pause("Notice","User LEFT clicked on icon. Press Cancel to Exit.") Break Case 2 Pause("Notice","User RIGHT clicked on icon. Press Cancel to Exit.") Break EndSwitch TimeDelay(.25) ;;;;;;;;; suspend here instead. EndWhile
The TimeDelay prevents WinBatch from consuming excessive CPU time while still being able to record mouse events. Check the amount of CPU used by WinBatch with Task Manager when the TimeDelay is not used.
Article ID: W18295
Filename: IntControl 1007 Slow.txt
File Created: 2010:12:13:10:56:56
Last Updated: 2010:12:13:10:56:56