Dialog initiation error

Started by rw_baker, January 14, 2017, 10:20:12 AM

Previous topic - Next topic

rw_baker

Very infrequently(for maybe the last month or so) scripts that initiate a Dialog come up with the attached error.  I immediately execute that script again and it runs through to completion without error (dialog is created without error).  This is such a minor inconvenience that I didn't log when it first came up.  I know of no conditions that make it happen.
I wonder if anyone else has noticed this error?  The scripts that contain the Dialogs have not been altered.

Running 2017A.

RW Baker

td

There are many reasons why you might get the error but since we know nothing about the dialog template or possible associated callback function, it is impossible to state what is causing the error in this particular case.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

There are three areas you might want to look at to start your attempt to discover the cause of this error:


  • Any thing in your script that might modify the dialog template before the dialog is displayed, e.g., substitution.
  • The initialization (@deInit) case of any dialog callback.
  • Other processes that might be attempting to interact with the WinBatch process.

Again, this is far from a complete list of possibilities.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

rw_baker

I appreciate your continued support!

Sunday AM I made an alteration in the script, that I have shown in the attachment.  Since then, there has not been an error.  Errors happen very infrequently, so I don't know if the alteration has helped.

RW Baker

td

Normally, WinBatch will automatically disable the caller dialog when you display a second dialog from the callback of the caller.  However, since you are starting a new process for your second it dialog will not happen so you need to disable a dialog before displaying a second dialog from a user defined callback.

It would be much simpler to display your second dialog by calling the 'Dialog' function directly from the callback of your first dialog.  But perhaps you have a legitimate  reason for not doing so.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

rw_baker

I think I do have a "legitimate reason", but I will take another look to confirm.

Thanks,

RW Baker

td

Generally, it is best to put your templates into separate files and then just #include them into your script file.  And yes you can still have the 'Dialog' function call in your template file.  You just have to set the second optional function parameter to 0.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

rw_baker

Fine, I have replaced:
call("F:\WBT\Programs\WDLs\calendar select.WDL","")
with:
#include "F:\WBT\Programs\WDLs\calendar select.WDL"
When you say:
"And yes you can still have the 'Dialog' function call in your template file.  You just have to set the second optional function parameter to 0."
Do you mean if I did use the "call" that it should be?
call("F:\WBT\Programs\WDLs\calendar select.WDL",0)      ;<- I used "" instead 0.
Does the 0 convey some special meaning to "call"?  I could have missed it, but I do not see any documentation in "call" for this?
Thanks,
RW Baker

td

You display a dialog in your script by using the Dialog function.  The WIL Dialog Editor uses the Dialog function to load the dialog template into the editor.   You place in #include statement in your script some place before you call the Dialog function with your included dialog template's name.  The included template file also has a Dialog statement in it but it is not executed by WinBatch because you (or Dialog Editor at your behest) has placed a 0 in the optional second parameter of that Dialog statement. This allows you to still edit the template in the WIL Dialog Editor without having to worry about the dialog display where or when you don't want it to.    So instead of using a "Call" statement in your main script to displaying your dialog, you use a Dialog statement without a second parameter set to 0.

"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

rw_baker

Finally...I get it now.
Thanks,
RW Baker