Automatic Fading (Timeout) Message>
Moderators: Dorian (MJT support), JRL
Automatic Fading (Timeout) Message>
Is there any trick to close the Macro Scheduler Message dialogbox automatically after, say, 30 seconds?
Use a non-modal message box and a timed loop. Here's an example with a subroutine that you can use in your script. Just set timeout as appropriate and then call the subroutine:
//Display a NON modal message
Message>Hello World
//Wait for user to close message, or timeout
Let>timeout=10
GoSub>MsgTimeout
MessageModal>Msg closed or timed out
SRT>MsgTimeout
Let>tick=0
Label>timeloop
Wait>1
Let>tick=tick+1
IfWindowOpen>Macro Scheduler Message
if>ticktimeloop
else
CloseWindow>Macro Scheduler Message
endif
endif
END>MsgTimeout
//Display a NON modal message
Message>Hello World
//Wait for user to close message, or timeout
Let>timeout=10
GoSub>MsgTimeout
MessageModal>Msg closed or timed out
SRT>MsgTimeout
Let>tick=0
Label>timeloop
Wait>1
Let>tick=tick+1
IfWindowOpen>Macro Scheduler Message
if>ticktimeloop
else
CloseWindow>Macro Scheduler Message
endif
endif
END>MsgTimeout
MJT Net Support
[email protected]
[email protected]
Dear Support,
Thanks a lot for writing a script solution. It turns out to be more lines required to implement the automatic closue of Macro Scheduler Message dialog box. Surprisingly, it turns out that my script is very similar to yours. Instead, I allow the script to run forward to save time and close the dialog box at some point which I deem the message is no longer valid.
Msg>Outlook PST is now being copied to JetFlash
If>COMPUTER_NAME=ARMSTRONG
run>....
run>....
run>....
Endif
WaitWindowOpen>BC Script
Gosub>CloseMsg
IfWindowOpen>BC Script
WaitWindowClosed>BC Script
Endif
Wait>1
PlayWave>C:\WINDOWS\Help\Tours\WindowsMediaPlayer\Audio\Wav\WMPAUD6.WAV
Goto>CheckPST
SRT>CloseMsg
IfWindowOpen>Macro Scheduler Message
CloseWindow>Macro Scheduler Message
Endif
End>CloseMsg
Hope the automatic message dialog box closure can be implemented in future. It can be easily done through a system variable, say, MSG_TIMEOUT.
Thanks for your very generous and thorough support.
Thanks a lot for writing a script solution. It turns out to be more lines required to implement the automatic closue of Macro Scheduler Message dialog box. Surprisingly, it turns out that my script is very similar to yours. Instead, I allow the script to run forward to save time and close the dialog box at some point which I deem the message is no longer valid.
Msg>Outlook PST is now being copied to JetFlash
If>COMPUTER_NAME=ARMSTRONG
run>....
run>....
run>....
Endif
WaitWindowOpen>BC Script
Gosub>CloseMsg
IfWindowOpen>BC Script
WaitWindowClosed>BC Script
Endif
Wait>1
PlayWave>C:\WINDOWS\Help\Tours\WindowsMediaPlayer\Audio\Wav\WMPAUD6.WAV
Goto>CheckPST
SRT>CloseMsg
IfWindowOpen>Macro Scheduler Message
CloseWindow>Macro Scheduler Message
Endif
End>CloseMsg
Hope the automatic message dialog box closure can be implemented in future. It can be easily done through a system variable, say, MSG_TIMEOUT.
Thanks for your very generous and thorough support.
This idea can be worked up into quite a nice routine, which can indicate whether you clicked the ok, maybe to mean not to accept some default action, and also with a counter indicating how much longer you've got before the timeout:
let>VAREXPLICIT=1
// Display a NON modal message
msg>click ok if want to see a counter on the next message
// Wait for user to close message, or timeout
gosub>msgtimeout
if>%msgtimeoutdefault%=NO
let>msgtimeoutprogress=YES
endif
SRT>msgtimeout
// wait for up to msgtimeout seconds for a Scheduler Message msgbox to close by being clicked
// then close it and indicate caller's default action is required, or indicate someone else closed it
// also, if msgtimeoutprogress=YES, the original msg is refreshed with a counter each msgtimeoutwait seconds
assigned>msgtimeout,msgtimeouttemp
if>%msgtimeouttemp%TRUE
let>msgtimeout=20
endif
assigned>msgtimeoutwait,msgtimeouttemp
if>%msgtimeouttemp%TRUE
let>msgtimeoutwait=0.5
endif
//let>msgtimeoutprogress=YES
let>msgtimeoutdefault=NO
let>msgtimeoutmax=%msgtimeout%/%msgtimeoutwait%
//ask>msgtimeoutmax=%msgtimeoutmax%,ok
let>msgtimeouttick=0
if>%msgtimeoutprogress%=YES
getwindowtext>Macro Scheduler Message,msgtimeouttext
stringreplace>%msgtimeouttext%,&OK,,msgtimeouttext
endif
label>msgtimeoutloop
wait>%msgtimeoutwait%
add>msgtimeouttick,1
IfWindowOpen>Macro Scheduler Message
//setfocus>Macro Scheduler Message
if>%msgtimeoutprogress%=YES
//msg>message window is still open after %msgtimeouttick% ticks %crlf% %crlf%%msgtimeouttext%
msg>%msgtimeouttext%%crlf%%crlf%- %msgtimeouttick% of %msgtimeoutmax% -
endif
//msg>window is still open after %msgtimeouttick% ticks
if>%msgtimeouttick%Macro Scheduler Message
let>msgtimeoutdefault=YES
//ask>window timeout after %msgtimeouttick% ticks,ok
else
//ask>window was clicked before %msgtimeouttick% ticks,ok
endif
END>msgtimeout
let>temp=%crlf%*** note: it will be difficult to click if you display the counter and have a v small wait time!
msg>click ok if want to alter the maximum response time to a click, currently it's %msgtimeoutwait% seconds %temp%
gosub>msgtimeout
if>%msgtimeoutdefault%YES
input>temp,specify maximum response in seconds,%msgtimeoutwait%
// ignore input if have null string from clicking cancel
if>%temp%
let>msgtimeoutwait=%temp%
endif
endif
msg>click ok if want to alter the default msg timeout of %msgtimeout% seconds
gosub>msgtimeout
if>msgtimeoutdefaultYES
input>temp,specify msg timeout period in seconds,%msgtimeout%
if>%temp%
let>msgtimeout=%temp%
endif
endif
msg>here's the 1st of 2 messages to test your settings%crlf%timeout=%msgtimeout% wait=%msgtimeoutwait%
gosub>msgtimeout
msg>here's the last messages to test the settings%crlf%timeout=%msgtimeout% wait=%msgtimeoutwait%
gosub>msgtimeout
let>VAREXPLICIT=1
// Display a NON modal message
msg>click ok if want to see a counter on the next message
// Wait for user to close message, or timeout
gosub>msgtimeout
if>%msgtimeoutdefault%=NO
let>msgtimeoutprogress=YES
endif
SRT>msgtimeout
// wait for up to msgtimeout seconds for a Scheduler Message msgbox to close by being clicked
// then close it and indicate caller's default action is required, or indicate someone else closed it
// also, if msgtimeoutprogress=YES, the original msg is refreshed with a counter each msgtimeoutwait seconds
assigned>msgtimeout,msgtimeouttemp
if>%msgtimeouttemp%TRUE
let>msgtimeout=20
endif
assigned>msgtimeoutwait,msgtimeouttemp
if>%msgtimeouttemp%TRUE
let>msgtimeoutwait=0.5
endif
//let>msgtimeoutprogress=YES
let>msgtimeoutdefault=NO
let>msgtimeoutmax=%msgtimeout%/%msgtimeoutwait%
//ask>msgtimeoutmax=%msgtimeoutmax%,ok
let>msgtimeouttick=0
if>%msgtimeoutprogress%=YES
getwindowtext>Macro Scheduler Message,msgtimeouttext
stringreplace>%msgtimeouttext%,&OK,,msgtimeouttext
endif
label>msgtimeoutloop
wait>%msgtimeoutwait%
add>msgtimeouttick,1
IfWindowOpen>Macro Scheduler Message
//setfocus>Macro Scheduler Message
if>%msgtimeoutprogress%=YES
//msg>message window is still open after %msgtimeouttick% ticks %crlf% %crlf%%msgtimeouttext%
msg>%msgtimeouttext%%crlf%%crlf%- %msgtimeouttick% of %msgtimeoutmax% -
endif
//msg>window is still open after %msgtimeouttick% ticks
if>%msgtimeouttick%Macro Scheduler Message
let>msgtimeoutdefault=YES
//ask>window timeout after %msgtimeouttick% ticks,ok
else
//ask>window was clicked before %msgtimeouttick% ticks,ok
endif
END>msgtimeout
let>temp=%crlf%*** note: it will be difficult to click if you display the counter and have a v small wait time!
msg>click ok if want to alter the maximum response time to a click, currently it's %msgtimeoutwait% seconds %temp%
gosub>msgtimeout
if>%msgtimeoutdefault%YES
input>temp,specify maximum response in seconds,%msgtimeoutwait%
// ignore input if have null string from clicking cancel
if>%temp%
let>msgtimeoutwait=%temp%
endif
endif
msg>click ok if want to alter the default msg timeout of %msgtimeout% seconds
gosub>msgtimeout
if>msgtimeoutdefaultYES
input>temp,specify msg timeout period in seconds,%msgtimeout%
if>%temp%
let>msgtimeout=%temp%
endif
endif
msg>here's the 1st of 2 messages to test your settings%crlf%timeout=%msgtimeout% wait=%msgtimeoutwait%
gosub>msgtimeout
msg>here's the last messages to test the settings%crlf%timeout=%msgtimeout% wait=%msgtimeoutwait%
gosub>msgtimeout