When, how are dialogs initialized?

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ichiban
Newbie
Posts: 8
Joined: Thu Apr 10, 2008 2:57 am

When, how are dialogs initialized?

Post by ichiban » Thu May 08, 2008 9:39 am

This is a rough, fictional example but similar to my script except that I've removed pre-initialization for global variables that are used in the dialog blocks. I'm trying to figure out why the dialog field Last Name: shows Unknown instead of Smith.

Let>VAREXPLICIT=1


// initialize Last_name but not First_name before dialog blocks
Let>Last_name={"Unknown"}
// watch: Last_name=Unknown


Dialog>MyName
// typical dialog lines
Label={"First Name:"},16,24
Edit={"Firstname"},48,16,145,%First_name%
Label={"Last Name:"},224,24
Edit={"Lastname"},264,16,153,%Last_name%
// more typical dialog lines
EndDialog>MyName
// watch: MyName.Firstname=%First_name%
// watch: MyName.Lastname=Unknown


Let>First_name="John"
// watch: First_name=John
Let>Last_name="Smith"
// watch: Last_name=Smith


Let>MyName.Firstname=%First_name%
// watch: MyName.Firstname=John
Let>MyName.Lastname=%Last_name%
// watch: MyName.Lastname=Smith


Show>MyName
// watch: MyName.Firstname=%First_name%
// dialog field First Name: John
// watch: MyName.Lastname=Unknown
// dialog field Last Name: Unknown

So again, one solution if I want the dialog field Last Name to show Smith is to not initialize the global variable before the dialog blocks but why?

Thanks

User avatar
Marcus Tettmar
Site Admin
Posts: 7391
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu May 08, 2008 10:19 am

After changing the variables that represent dialog object values you need to do:

ResetDialogAction>MyName

This updates the dialog with the values of MyName.LastName etc.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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