The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#28196 by jmshehane
Fri Sep 21, 2007 7:16 am
Could somebody give me an example of how to use both of these? I run the following code:

MyInt2 := ExecProg('C:\datacad\test.bat','test.bat','',myint);

and it returns 1, and nothing happens. But from what i've read, 1 is a good thing. I would expect the batch file to pop open and run (I expect the same from .exe files)

I've also tried the ExecAndWait, and it returns a -1, and again does nothing. Also what is the "Visibility" variable in the ExecAndWait, I can't find any documentation on what integer means what.

Thanks in advance!

Oh yeah, I'm programming form DCAD 9. So no Delphi.
#28199 by David A. Giesselman
Fri Sep 21, 2007 7:55 am
jmshehane wrote:Could somebody give me an example of how to use both of these? I run the following code:

MyInt2 := ExecProg('C:\datacad\test.bat','test.bat','',myint);


You've got your parameters a little mixed up there. Try:

Code: Select allMyInt2 := ExecProg('C:\datacad\','test.bat','',myint);

you then wrote:I've also tried the ExecAndWait, and it returns a -1, and again does nothing. Also what is the "Visibility" variable in the ExecAndWait, I can't find any documentation on what integer means what.


That specifies the visibility of the spawned command window.
  • Hidden (SW_HIDE) = 0;
  • Normal (SW_SHOWNORMAL ) = 1;
  • Minimized (SW_SHOWMINIMIZED ) = 2;
  • Maximized (SW_SHOWMAXIMIZED ) = 3;

Dave
#28226 by jmshehane
Fri Sep 21, 2007 3:14 pm
Still no go. Ive tried:

MyInt2 := ExecProg('C:\datacad','\test.bat','',myint);
and
MyInt2 := ExecProg('C:\datacad','test.bat','',myint);
and
MyInt2 := ExecProg('C:\datacad\\','test.bat','',myint);

The batch file just has a pause statement so I can see that it actually opened up. And the function returns 1 (which mean's it was supposedly successful). Is there anything else I could be missing? Thanks,

Again, I'm using legacy DCAL compiler 5.0 for DCAD 9 on Windows XP SP2.
#28228 by jmshehane
Fri Sep 21, 2007 3:25 pm
Nevermind, all is well. I've been a Java and C# programmer for years so the Pascal stuff gets me everytime (not to mention i don't have a developing env, just notepad). Apparently the backslash (as in Java and C#) is an escape character. So this actually works:

MyInt2 := ExecProg('C:\\datacad\\','test.bat','',myint);

the "d" was getting escaped instead of my backslash. thanks for the help.
#28231 by David A. Giesselman
Fri Sep 21, 2007 3:34 pm
Ah yes, I completely forgot about that aspect of DCAL as well.
#72681 by dhs
Sat Nov 11, 2017 8:11 pm
I only recently realised that I could pass parameters to the ExecAndWait procedure by adding the parameter to the prog parameter (separated from the program name by a space) as in the following example:

Code: Select all         getpath (tempstr, pathsup);
         strcat (tempstr, 'dhsoftware\\ShadHelp.exe v1.1.08');   !v.1.1.08 is a parameter
         ExecAndWait (tempstr, 1, res);


But, I have never used the ExecProg function because it in not documented (other than a passing mention in the ExecAndWait documentation), and I did not know what the parameters were (or even if it needed to be declared as a builtin function).
So having found this old post I have been able to get ExecProg working by following the example code that Dave G provided in one of his responses. but it is still not fully documented. Is anybody able to advise what the last 2 parameters are. I have passed a blank string and an integer variable as per the example, but I would really like to know what they are actually used for ...
#72691 by David A. Giesselman
Mon Nov 13, 2017 5:16 pm
The 2nd parameter indicates the window state to use:

  • 1 = Normal window
  • 2 = Minimized window
  • 3 = Maximized window
The 3rd parameter returns the result; 1=Success, 0=Failed

Dave
#72698 by dhs
Mon Nov 13, 2017 8:28 pm
Thanks Dave,

But I think you have answered regarding ExecAndWait, but I was asking about the parameters for ExecProg.

I have now realised that I can probably work out the parameters by looking at the UInterfaces file supplied with DCAL for Delphi, so expect that they are as follows:
FUNCTION ExecProg (path, prog, parameters : str255; ret : OUT integer) : integer;

As I noted, the above is what I expect, but could be wrong so would be grateful if you could correct me if required. Also, it is not clear to me what the last parameter (ret) is ... if it is a return code then what is the integer result of the function (which I would have assumed to be the return code)?

Thanks,
David H

p.s. thanks for the information on the WindowState values. I have had trouble finding these values in the past (and just settled on using 1 as it produced the desired result), and had only recently found them in one of your previous responses within this thread.

Who is online

Users browsing this forum: No registered users and 4 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984