ResetDialogAction trouble with resetting

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

ResetDialogAction trouble with resetting

Post by kpassaur » Mon Jul 02, 2007 2:56 pm

This is part of a large scrip that calls antother compiled macro. Easier than dealing with multible Non-Modal dialogs. However, once the script is run and it is time to reset the dialog it shows the dialog action that i set (in this case 0) it returns to the loop showing 0 until it gets to GetDialogAction at which times it resets itself to "2" which exits the Script.

What can be done differently - anyone know?

Show>Dialog1
Label>Dialog1loop
GetDialogAction>Dialog1,daction1
If>daction1=1,Parseline
If>daction1=3,Endit
If>daction1=2,ExitScript
If>daction1=4,Deletetheitem
///If>daction1=5,Parsebyvaluespresent
Goto>Dialog1loop


SRT>Parseline
CloseDialog>Dialog1

Let>RP_WAIT=1
Run Program>C:\consolegrab\Programs\Parselinewizard.exe /Profiletouse=%Profiletouse%
////Need to update list and reset
GoSub>readvariablelist
GoSub>getdisplaylist
MDL>checkpoint
let>daction1=0
ResetDialogAction>Dialog1
End>Parseline

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

Post by Marcus Tettmar » Mon Jul 02, 2007 3:03 pm

Not sure what you are expecting the following to do:

let>daction1=0
ResetDialogAction>Dialog1

The value of daction1 will have no effect on Dialog1

Not sure what you are trying to do. If you want to set the value of an object on the dialog you need to something like:

Let>Dialog1.EditBox1=0
ResetDialogAction>Dialog1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

ResetDialogAction

Post by kpassaur » Mon Jul 02, 2007 3:43 pm

Marcus

What I am tring to do is reset a dialog action.

I am getting the dialog action in this loop and it is referred to as daction1


Show>Dialog1
Label>Dialog1loop
GetDialogAction>Dialog1,daction1
If>daction1=1,Parseline
If>daction1=3,Endit
If>daction1=2,ExitScript
If>daction1=4,Deletetheitem
///If>daction1=5,Parsebyvaluespresent
Goto>Dialog1loop


I enter 1 and it correctly goes to the subroutine Parseline


SRT>Parseline
CloseDialog>Dialog1
Let>RP_WAIT=1
Run Program>C:\consolegrab\Programs\Parselinewizard.exe /Profiletouse=%Profiletouse%
////Need to update list and reset
GoSub>readvariablelist
GoSub>getdisplaylist
MDL>checkpoint
let>daction1=0
ResetDialogAction>Dialog1
End>Parseline

After the subroutine it is exiting the script

So I viewed the watch list and saw that after it cycles through the loop Dialog1loop and gets to the line that contains
GetDialogAction>
it sets daction1=2 - this should be "0" according to the help file

So,in hopes of fooling it, I tried entering the line
Let>daction1=0
before the ResetDialogAction line as in your example
Let>Dialog1.EditBox1=0

And it still does not work.

Hopefully this is a better explaination. I have had this issue in the past, but I just used a similar line like above to a not existant action like
Let>daction1=10 to prevent this.

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

Post by Marcus Tettmar » Mon Jul 02, 2007 4:27 pm

daction is the result variable returned by the GetDialogAction command. Setting it will have no effect on what ResetDialogAction does. I still don't understand what it is you are trying to set on the dialog.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Trying to do on the Dialog

Post by kpassaur » Mon Jul 02, 2007 5:16 pm

Marcus

I am very simply trying to run a subroutine that contains a compiled script (I only mention it in case it is causing the problem) and two more subroutines and have a Dialog box updated.

It works like this
First
The subroutine calls a compiled script
When this is done
Two more subroutines are called

After that I need to display the Dialog again, when I do there is a list box that will be updated.

However, the script exits upon returning to the loop that initally displayed it.

Hopefully that makes sense

When I use the watch list and step through it, I can see the script return to the loop that displayed the dialog. However the value that I am using "daction1" is not reset to "0" after
ResetDialogAction>Dialog1
has been executed

Now my understanding from the help files is that once ResetDialogAction is executed the value should be reset to "0" if it wasn't I suppose you would have a continious loop. I don't have a continious loop, it just exits.


Here is the example from the help file

Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=5,Update
if>r=6,Close
if>r=2,exit
Goto>ActionLoop

Label>exit

SRT>Update
Let>Dialog1.msEdit2=%Dialog1.msEdit1% %Dialog1.msComboBox1%
ResetDialogAction>Dialog1
END>Update


Now what I am saying is that r is now "0" after the subroutine Update has been run.

I am not using "r" but "daction1" instead. I use ResetDialogAction and it is not being reset. It is being automatically set to "2" that is the problem. It is a problem because "2" exits the Dialog which in turn exits the script

I may be not be understanding the help files correctly. But how do I get it not to exit. I have experienced this in the past and I just placed a line in the script before the Resetdialogaction line that would that seemed to take care of it by setting the value to something that was not there.

Could the ResetDialogAction be getting the action from the compiled script that was run? The last action on that one was "2". However, it still should have been reset to "0"

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

Post by Marcus Tettmar » Mon Jul 02, 2007 5:23 pm

I see. ResetDialogAction should be enough to reset the modal result. So I don't think the issue is with ResetDialogAction. Sounds like something else is changing daction and/or causing the loop to exit.

I presume you've stepped through with the debugger? At what point is the loop exiting?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Reset dialog action

Post by kpassaur » Mon Jul 02, 2007 5:44 pm

I have been using the watch list and experienced the following

When I run it, it does not reset daction1=0 when ResetDialogAction is executed

However, if I enter
daction1=0
before ResetDialogAction it is reset to "0" (this can be seen in the watch list)

But, when it goes through the loop and the loop gets to Getdialogaction>daction1 it is reset to "2"

That is the problem.

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

Post by JRL » Mon Jul 02, 2007 6:10 pm

Sorry to intrude.

If I step through the following script, r1 shows = to 0 until after the dialog closes, then getdialogaction sets r1 to 2. So my suspicion would be that you have closed the dialog.

Hope this helps

Code: Select all

Dialog>Dialog1
   Caption=Dialog1
   Width=445
   Height=250
   Top=116
   Left=25
   Button=msButton1,168,160,75,25,0
EndDialog>Dialog1

Show>dialog1
Label>start
GetDialogAction>dialog1,r1
/////
closedialog>dialog1
ResetDialogAction>dialog1
goto>start

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Reset Dialog Action

Post by kpassaur » Mon Jul 02, 2007 6:23 pm

That was it!

I added the line to Show it again and now it seems to be working correctly

Thanks

KP

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