ResetDialogAction question

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

ResetDialogAction question

Post by rullbandspelare » Sat Apr 21, 2007 12:12 am

I dont understand how to use the ResetDialogAction in MS 7.4
The example below is NOT the actual code, but an example of what I want to do. I Whant to have the Edit field filled out at the first view of the Dialog. If I remove the // bellow it will do as i want. But then all the Buttons and text in the Dialog gets wierd (%MyDialog.% all over the place)
I know that I can put %tíme% directly in the Dialog, but that will not help me in the real code I am working on. There, when I put ResetDialogAction in a SRT after the Show>MyDialog, I will have to "reload" my Dialog twice to get the real values into the Dialog.

Code: Select all

Dialog>MyDialog
  Caption=This is My Dialog
  Left=300
  Top=300
  Width=305
  Height=120
  Label=Type Something Here:,5,5
  Edit=MyEdit,5,22,230,
  Button=Update,240,22,50,20,3
  Button=Exit Macro,5,50,100,20,2
EndDialog>MyDialog

 GetTime>time
 Let>MyDialog.MyEdit=%time%
// ResetDialogAction>MyDialog

Label>MainLoop
  Show>MyDialog,result
  If>result=2,End
  If>result=3,SayHello
Goto>MainLoop

SRT>SayHello
   GetTime>time
   Let>MyDialog.MyEdit=%time%
   ResetDialogAction>MyDialog
END>SayHello

Label>End
Thanks!

/tomas

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

Post by JRL » Sat Apr 21, 2007 3:43 am

You're looping around and showing a dialog that's already being shown. All you need to do is add one CloseDialog> line

Code: Select all

Dialog>MyDialog
  Caption=This is My Dialog
  Left=300
  Top=300
  Width=305
  Height=120
  Label=Type Something Here:,5,5
  Edit=MyEdit,5,22,230,
  Button=Update,240,22,50,20,3
  Button=Exit Macro,5,50,100,20,2
EndDialog>MyDialog

 GetTime>time
 Let>MyDialog.MyEdit=%time%
// ResetDialogAction>MyDialog

Label>MainLoop
  Show>MyDialog,result
  If>result=2,End
  If>result=3,SayHello
Goto>MainLoop

SRT>SayHello
   GetTime>time
   Let>MyDialog.MyEdit=%time%
   ResetDialogAction>MyDialog
   CloseDialog>MyDialog
END>SayHello

Label>End

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Sat Apr 21, 2007 7:16 am

Thanks, but that realy didnt change anything.
The script still only works if i uncomment the line with
// ResetDialogAction>MyDialog
But then the there still is this wierd behavior that makes all the button unreadable.

The first time
Show>MyDialog,result
is executed it will not accept
Let>MyDialog.MyEdit=%time%
unless i
ResetDialogAction>MyDialog
that is the problem

Thanks
/tomas

rullbandspelare
Pro Scripter
Posts: 149
Joined: Tue Mar 23, 2004 9:11 pm

Post by rullbandspelare » Sat Apr 21, 2007 7:29 am

Solved!
The
CloseDialog>MyDialog
Was a part of the solution.
If I start off with a quick
Show>MyDialog
CloseDialog>MyDialog
Then it works

Code: Select all

Dialog>MyDialog
  Caption=This is My Dialog
  Left=300
  Top=300
  Width=305
  Height=120
  Label=Type Something Here:,5,5
  Edit=MyEdit,5,22,230,
  Button=Update,240,22,50,20,3
  Button=Exit Macro,5,50,100,20,2
EndDialog>MyDialog

Show>MyDialog
 GetTime>time
 Let>MyDialog.MyEdit=%time%
ResetDialogAction>MyDialog
CloseDialog>MyDialog
Label>MainLoop
  Show>MyDialog,result
  If>result=2,End
  If>result=3,SayHello
Goto>MainLoop

SRT>SayHello
   GetTime>time
   Let>MyDialog.MyEdit=%time%
   ResetDialogAction>MyDialog
   CloseDialog>MyDialog
END>SayHello

Label>End

Thanks

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