| || |
Display an Information message, letting script continue witho ut any action being required?
User Jon Daily (JDaily@procard.com.nospam) posted:
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
Hey gang, thanks for the feedback. I actually found a nearly perfect example
in the online help system. (imagine THAT!)
I tweaked it a little bit to eliminate the buttons since I don't want anyone
to be able to continue or cancel until AFTER the delay. (I couldn't figure
out how to actually ELIMINATE the buttons, so I just defined them as 1x1 and
pushed them to the lower corner of the dialog box.
Here's the code I have in place.
1. Defined LengthMins and Length as global variables in header file.
2. Function code in library file:
Static timeoutStart as Long
Static currentSecs as Long
Dim thisSecs as Long
Select Case action%
' initialize the dialog box. Set the ticker value to 30
' and remember when we put up the dialog box
DlgText "ticker", ""&Length
timeoutStart = timer
currentSecs = Length
' this is an idle message - set thisSecs to the number of
' seconds left until timeout
thisSecs = timer
If thisSecs < timeoutStart Then thisSecs = thisSecs + 24*60*60
thisSecs = Length - (thisSecs - timeoutStart)
' if there are negative seconds left, timeout!
If thisSecs < 0 Then DlgEnd -1
' If the seconds left has changed since last time,
' update the dialog box
If thisSecs <> currentSecs Then
DlgText "ticker", trim$(str$(thisSecs))
currentSecs = thisSecs
' make sure to return non-zero so we keep getting idle messages
timeout = 1
3. Script calling the function:
'Waits 3 minutes for emails to process
'Define delay length for dialog box
LengthMins = 2
length = LengthMins * 60
Begin Dialog newdlg 160, 68, "Delay Information", .timeout
OKButton 159, 67, 1, 1
CancelButton 159, 67, 1, 1
Text 15, 5, 145, 8, "The script is now on a delay for"
Text 115, 5, 28, 8, ""&LengthMins
Text 15, 13, 145, 8, "minutes to allow emails to process."
Text 15, 28, 145, 8, "Time remaining in delay:"
Text 91, 28, 14, 8, ""&length, .ticker
Text 105, 28, 30, 8, "seconds."
Text 15, 43, 145, 8, "This box will close automatically after"
Text 15, 51, 145, 8, "the delay is finished."
Dim dlgVar As newdlg
If dialog(dlgvar) = 0 Then
Exit Sub ' abort
Thanks again for your replies.