Trying to get Dialog reset working with a variable update.

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ainterne
Junior Coder
Posts: 29
Joined: Tue Jun 05, 2007 4:03 am

Trying to get Dialog reset working with a variable update.

Post by ainterne » Thu May 07, 2009 12:44 pm

Perhaps I have just looked at this to much, however I can't get this script to work quite right.

My intent is to replace the numbers with graphics, so this is really a proof of concent on my part to see if I can get variables to keep updating in a dialog box. Also that there will be 10 numbers appearing on screen next to each other that all randomly update.

I can do it pretty easilly with 10 graphics all on top of each other and settting the visable propery but it seems like a lot of code.

At the moment I can't get past the numbers not updating correctly in the dialog.

Any help is much appreciated.


Code: Select all

Dialog>Dialog1
   Caption=Counter
   Width=153
   Height=138
   Top=CENTER
   Left=CENTER
   Max=1
   Min=1
   Close=1
   Resize=0
   Label=%num%,40,40,true
EndDialog>Dialog1

RGB=255,255,255,aColor
 SetDialogObjectFont>Dialog1,,Arial,16,,aColor
RGB=0,0,0,bColor
 SetDialogObjectColor>Dialog1,,bColor

Let>num=0
show>Dialog1

Label>restart

Random>100,Dice1
 Let>num=Dice1
 ResetDialogAction>Dialog1
 show>Dialog1
 wait>1

Random>100,Dice2
 Let>num=Dice2
 ResetDialogAction>Dialog1
  Show>Dialog1
  wait>1

Random>100,Dice3
 Let>num=4
 ResetDialogAction>Dialog1
  Show>Dialog1
  wait>1

Goto>restart

Phil.......

User avatar
Rain
Automation Wizard
Posts: 550
Joined: Tue Aug 09, 2005 5:02 pm
Contact:

Post by Rain » Thu May 07, 2009 12:57 pm

Hi Phil,
You need to set the label to display the random number by using Let>Dialog1.msLabel1=%num% in your loop.

This script now displays the random numbers.

Code: Select all

Dialog>Dialog1
   Caption=Counter
   Width=153
   Height=138
   Top=CENTER
   Left=CENTER
   Max=1
   Min=1
   Close=1
   Resize=0
   Label=%num%,40,40,true
EndDialog>Dialog1

RGB=255,255,255,aColor
 SetDialogObjectFont>Dialog1,,Arial,16,,aColor
RGB=0,0,0,bColor
 SetDialogObjectColor>Dialog1,,bColor

Let>num=0
show>Dialog1

Label>restart

Random>100,Dice1
 Let>num=Dice1
 let>Dialog1.msLabel1=%num%
 ResetDialogAction>Dialog1
 show>Dialog1
 wait>1

Random>100,Dice2
 Let>num=Dice2
 let>Dialog1.msLabel1=%num%
 ResetDialogAction>Dialog1
  Show>Dialog1
  wait>1

Random>100,Dice3
 Let>num=4
 let>Dialog1.msLabel1=%num%
 ResetDialogAction>Dialog1
  Show>Dialog1
  wait>1

Goto>restart
Cheers

ainterne
Junior Coder
Posts: 29
Joined: Tue Jun 05, 2007 4:03 am

Post by ainterne » Thu May 07, 2009 1:12 pm

One stunned member here..!!.... lol.....

Thank you Rain......I looked at this for ages thinking why oh why does this this not work...

I use the dialog boxes all the time now with huge amounts of content and I never forget those things..........then just jotting down a simple script I forget the obvious....

Yes I feel really silly now :oops:

Thank you very much....
Phil.......

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