Dialog close but script keep running

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Dialog close but script keep running

Post by timle » Tue May 01, 2012 11:38 pm

Hello,
I have a script with the sub routine to re-run every 10 second. But the script keep running eventhough I close the dialog.
Can I make it so if I close the dialog, it close every thing that is running

thank you

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Wed May 02, 2012 4:23 am

Not sure what you are trying to do but a dialog handler can be used to close the script when a dialog is closed.

Code: Select all

Dialog>Dialog1
object Dialog1: TForm
  Caption = 'Do Something'
  ClientHeight = 61
  ClientWidth = 190
  object Label1: TLabel
    Left = 24
    Top = 8
    Width = 130
    Height = 13
    Caption = 'Pick the "X" to stop the script'
  end
  object Label2: TLabel
    Left = 32
    Top = 32
    Width = 3
    Height = 13
  end
end
EndDialog>Dialog1

//Use a dialog handler using the OnClose event
AddDialogHandler>Dialog1,,OnClose,Quit
//One more dialog handler for the guy who wants to pick the label "X"
AddDialogHandler>Dialog1,label1,OnClick,Quit

Show>dialog1

Label>Loop
  Wait>1
  GoSub>DoSomething
Goto>Loop

SRT>Quit
  Exit>0
END>Quit

SRT>DoSomething
  Let>kk=0
  Repeat>kk
    Add>kk,1
    SetDialogProperty>dialog1,label2,caption,Do something %kk% times
    Wait>0.01
  Until>kk=1000
END>DoSomething

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Post by timle » Thu May 03, 2012 11:58 pm

Thankyou let me try it

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts