You seem to be learning quickly and you're doing a good job of working for yourself and asking for assistance, rather than asking for someone to write the script for you. That said, here's a rewrite of the last script you posted. Only a couple of changes but in my mind they're important to get you set off in the right direction.
Added Freeze and Thaw subroutines that set a flag (variable named Frozen) that can be tested in the main loop. This allows the program to continue running. As you had it the program would halt and the only available option was to close. For this script that might be fine but for future reference and to make this dialog more interesting use flags.
The problem you had with the progress bar causing the the buttons to fail was the location of the ResetDialogAction in relation to the Wait>.5. As you had them positioned the dialog would wait for a half of a second (during which time you were clicking a button) and at the end of the half second the dialog was reset. Resetting the dialog made the Action variable equal to zero. You had a millisecond long window of opportunity to pick a button and have the action of the button execute followed by a half second window of opportunity for the button selection to be reset to zero before any action could take place. The odds were against you. I simply moved the wait>.5 to occur after the ResetDialogAction so the the odds were back in your favor.
Notice how the button names change and why. Also notice that the button and label references are numbered (dialog1.msbutton1, dialog1.msbutton2) and that the order of the numbering corresponds to the position of the button or label in the dialog definition. This is important to know because if you change or rearrange the dialog you might also need to change the names of the references to the button or label objects. Also note that a ResetDialogAction is required for the object rename to show up in the dialog.
Try this:
Code: Select all
Let>MyCaption= Friendly Reminder
Let>MyLabel= Just a note to remind you about company policies regarding computer usage.%CRLF%%CRLF% Details are in J:\Data\Word\Common\ComputerUsage.doc.%CRLF%%CRLF% Seconds remaining = %Remaining%.
Let>Delay=10
Let>k=0
Let>Frozen=0
Dialog>Dialog1
Caption=%MyCaption%
Max=0
Min=0
Close=0
Resize=0
Width=445
Height=300
Top=134
Left=42
Label=%MyLabel% %CRLF%%CRLF% Thank you. Have Fun!%CRLF%%CRLF%%CRLF%%CRLF%%CRLF%%CRLF%%CRLF%%CRLF%%CRLF%%CRLF% Reminder will disappear in a few seconds.,5,5
Button= ,20,160,70,20,3
Button=Pause,100,160,70,20,4
ProgressBar=Countdown,220,180,200,20,0
Default=Close
EndDialog>Dialog1
Show>Dialog1
Label>Loop1
GetDialogAction>dialog1,Action
If>Frozen=0
If>%Action%=4,Freeze
EndIf
If>Frozen=1
If>%Action%=4,Thaw
EndIf
If>%k%>4
If>%Action%=3,Finished
Let>Dialog1.msbutton1=Close
EndIf
If>Frozen=0
// Using .5 vs. 1 for smoother Progress Bar
Add>k,.5
If>%k%=%Delay%,Finished
Let>Remaining=%Delay%-%k%
Let>Pct={%k%/%Delay%*100}
Let>Dialog1.Countdown=%Pct%
ResetDialogAction>Dialog1
EndIf
Wait>.5
Goto>Loop1
SRT>Freeze
Let>Frozen=1
Let>Dialog1.msbutton2=Continue
Let>Action=0
ResetDialogAction>dialog1
END>Freeze
SRT>Thaw
Let>Frozen=0
Let>Dialog1.msbutton2=Pause
Let>Action=0
ResetDialogAction>dialog1
END>Thaw
Label>Finished
CloseDialog>Dialog1
Goto>End
Label>End