Dialog.SetTimer/Dialog.KillTimer example?

DO 12.2.3 comes with Dialog.SetTimer/Dialog.KillTimer without an example, could someone please give me one about how to use it in VBScript/JScript? Thanks in advance!

Here's an example that creates a simple clock.

Clock.dcf (1.84 KB)


The script code looks like this:

Option Explicit
Function OnClick(ByRef clickData)

	Dim Dlg, Msg, Timer
	Set Dlg = DOpus.Dlg
	Dlg.template = "clock"
	Dlg.detach = True
	Dlg.Show

	Timer = Dlg.SetTimer(1000)

	Do
		Set Msg = Dlg.GetMsg()
		if Msg.event = "timer" Then
			DOpus.Output "tick"
			Dlg.Control("time").label = FormatDateTime(Now, vbLongTime)
		end if
	Loop While Msg
	
End Function

Thank you very much for your help, Jon!

If someone wants to try this example without using the Clock.dcf, don't forget to copy the resources:

<resources>
	<resource name="clock" type="dialog">
		<dialog fontsize="20" height="21" lang="english" width="60">
			<control halign="left" height="8" name="time" type="static" width="48" x="6" y="6" />
		</dialog>
	</resource>
</resources>