I'm trying to test a loop that re-uses a dialog (with some changes in text), but I get some errors after the first use:
error trying to create dialog: startdialog
ini file in editinifile does not exist (interesting, there is no ini file in the script)
I'm guessing I'm missing the right dialog reset command, I've tried several without success and would appreciate some help.
This is my test code:
Let>n=0
Let>startcap=Start Here
Label>start
Dialog>startdialog
Caption=%startcap%
Left=300
Top=300
Width=440
Height=140
Label=Enter Something,7,25
Edit=something,120,22,230,
Button=OK,5,50,100,20,1
EndDialog>startdialog
Show>startdialog,result
Goto>login
Label>login
Let>n=n+1
If>startdialog.something=doggy,success
If>n=3,sorry
Let>startcap=Try Again
Goto>start
Label>success
MDL>success
Goto>finish
Label>sorry
MDL>Three tries max
Label>finish
Recycle a dialog
Moderators: JRL, Dorian (MJT support)
You can't load the same dialog twice but you can change the dialog title by using "LibFunc>user32,SetWindowTextA"
I'm using a non-modal dialog in this example.
I hope this helps.
I'm using a non-modal dialog in this example.
Code: Select all
Let>n=0
Dialog>startdialog
Caption=Start Here
Left=300
Top=300
Width=440
Height=140
Label=Enter Something,7,25
Edit=something,120,22,230,
Button=OK,5,50,100,20,1
EndDialog>startdialog
Show>startdialog
Label>StartLoop
wait>0.1
GetDialogAction>startdialog,result
If>result=1,login
If>result=2,2
Goto>StartLoop
Label>login
ResetDialogAction>startdialog
Let>n=n+1
If>startdialog.something=doggy,success
If>n=3,sorry
// Change dialog title
Let>startcap=Try Again (Error %n%)
Let>WIN_USEHANDLE=1
GetActiveWindow>hwnd,X,Y
LibFunc>user32,SetWindowTextA,res,hwnd,%startcap%
CloseDialog>startdialog
Show>startdialog
Goto>StartLoop
Label>success
CloseDialog>startdialog
MDL>success
Goto>2
Label>sorry
CloseDialog>startdialog
MDL>Three tries max
Label>2
Hi Rain,
I also wanted to say thanks... just added that code to snippets as:
I also wanted to say thanks... just added that code to snippets as:
- change dialog title based on user input
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
