Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MDL calling Batch

109 views
Skip to first unread message

Lars Bo Wassini

unread,
Apr 15, 1998, 3:00:00 AM4/15/98
to

I seems to have a problem:

I have an MDL application that opens an external database and
reads from this a number of dgn files to create. That is done in
a interativ loop and for each file I would like to execute a
macro script (keyin), but the problem seems to be, that the macro
is just placed in the message queue and waits for the MDL program
to terminate.

Is there a way to get the macro to execute before the MDL program
continues?

--
Lars Bo Wassini
Odense Steel Shipyard, Denmark
* Do not remove NOSPAM in e-mail *

Ray Joslyn

unread,
Apr 15, 1998, 3:00:00 AM4/15/98
to

Lars,
heres a bit of code that may help, it uses an external program call
instead of a keyin command to execute the batch file.

static MSExternalProgramDescr *pgmDescrP;
char progName[MAXFILELENGTH],commandParams[MAXFILELENGTH],err[100];
int status;

if ((pgmDescrP = (MSExternalProgramDescr *)
mdlExternal_startProgram(progName,commandParams)) == NULL)
{
sprintf(err,"cannot execute %s Error %d",progName,mdlErrno);
_displayMessage(err);
}
else
mdlExternal_wait(&status,pgmDescrP);

atr...@iname.com

unread,
Apr 16, 1998, 3:00:00 AM4/16/98
to

ne...@BENTLEY.COM wrote:

> I have an MDL application that opens an external database and
> reads from this a number of dgn files to create. That is done in
> a interativ loop and for each file I would like to execute a
> macro script (keyin), but the problem seems to be, that the macro
> is just placed in the message queue and waits for the MDL program
> to terminate.

I have had a similar problem:

Instead of opening files, i simply send key-ins:

mdlInput_sendKeyin ("NEWFILE FILE1.DGN", 1, INPUTQ_EOQ, NULL);
mdlInput_sendKeyin ("NEWFILE FILE2.DGN", 1, INPUTQ_EOQ, NULL);
mdlInput_sendKeyin ("NEWFILE FILE3.DGN", 1, INPUTQ_EOQ, NULL);

Then, each time a file is opened (you must intercept function that is
called for this event), you send another key-in that is immediately
executed:

mdlInput_sendKeyin ("MACRO MYMACRO", 1, 0, NULL);

This works for me (i have written an application that can run a command
for each file in a set; the utility filepro that i have tried sometimes
failed with certain commands while this works)

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/ Now offering spam-free web-based newsreading

Timo Gunst

unread,
Apr 16, 1998, 3:00:00 AM4/16/98
to

After sending the keyin execute the following two lines:

mdlInput_sendResume (INPUTQ_EOQ);
mdlInput_waitForMessage ();

The functions require the -csoff switch when linking

Regards,
Timo Gunst

Lars Bo Wassini <NOSP...@usaX.net> wrote in article
<6h2khm$8po$1...@mdtyr.oss.dk>...


> I seems to have a problem:
>

> I have an MDL application that opens an external database and
> reads from this a number of dgn files to create. That is done in
> a interativ loop and for each file I would like to execute a
> macro script (keyin), but the problem seems to be, that the macro
> is just placed in the message queue and waits for the MDL program
> to terminate.
>

Lars Bo Wassini

unread,
Apr 16, 1998, 3:00:00 AM4/16/98
to

Timo Gunst wrote in message
<01bd6904$8ba5b380$e80864c2@appcon>...

>After sending the keyin execute the following two lines:
[snip]

I keep getting the mesage:
"MDL detected invalid use of suspend."

I do use the -csoff switch in the link!

--
Lars Bo Wassini

Chris Zakrewsky

unread,
Apr 16, 1998, 3:00:00 AM4/16/98
to

> "MDL detected invalid use of suspend."

This happens when you call WaitForMessage stuff from within a dialog box hook.
It MUST be called from main().

HTH
--
Remaining With Our Very Best Regards,

/Chris Zakrewsky
+------------------------------------------------------+
| ch...@cadperf.se http://www.ustation.se |
+------------------------------------------------------+
| CAD Perfect Development Lab Co. |
| Torpangsvagen 9, S-187 63 TABY, SWEDEN |
| Int'l. tel/fax +46 8 756 1353 |
+------------------------------------------------------+
| Bentley Sales Center, Independent Software Developer |
+------------------------------------------------------+


Lars Bo Wassini <NOSP...@usaX.net> wrote in article <6h4nru$kir$1...@mdtyr.oss.dk>...

Lars Bo Wassini

unread,
Apr 22, 1998, 3:00:00 AM4/22/98
to

Chris Zakrewsky wrote in message
<01bd695f$a1e6d0b0$656f7a7b@kitty>...

>> "MDL detected invalid use of suspend."
>
>This happens when you call WaitForMessage stuff from within a
dialog box hook.
>It MUST be called from main().

OK - Now I created a whole new project with only a key-in call
and a WaitForMessage call and I still get the error! (?)

---RUNMACRO.C ---------------------------------------------------
--------------
#include <basedefs.h>
#include <basetype.h>
#include <MSINPUTQ.H>

int main()
{
mdlInput_sendKeyin("macro test", 1, INPUTQ_EOQ, NULL);

mdlInput_sendResume (INPUTQ_EOQ);

mdlInput_waitForMessage();

mdlSystem_exit(0, 1);

return 0;
}

-----------------------------------------------------------------
-------

***********

---
RUNMACRO.MAK ----------------------------------------------------
--------

INC1 = $(MS)/mdl/include
INC2 = $(MS)/mdl/include/stdlib

RunMacro.ma: RunMacro.obj
mlink -aRunMacro.ma -g -csoff -s10000 RunMacro.obj

RunMacro.obj : RunMacro.c RunMacro.mak
mcomp -c -g -i$(INC1) -i$(INC1) -oRunMacro.obj RunMacro.c

-----------------------------------------------------------------
-------

Malcolm Powell

unread,
Apr 22, 1998, 3:00:00 AM4/22/98
to

Dear Lars,

Forget trying to use mdlInput_waitForMessage().

If you want to know (in MDL) when a Basic Macro has completed you
should get the Basic Macro to send a message to your MDL program when
it's completed. This can be done easily by adding in the last line of
that Macro
MbeSendKeyin "mjpcell next"
where CMD_MJPCELL_NEXT is the relevant command in your mdl application.

If you want/need a complete working example you'll have to mail me.

Malcolm Powell.

kike@feedme

unread,
Apr 22, 1998, 3:00:00 AM4/22/98
to

You can check an example provided with MicroStation. NTBANG start an external
app. an use the function MdlExternal_wait.... you can try this.


> I seems to have a problem:
>
> I have an MDL application that opens an external database and
> reads from this a number of dgn files to create. That is done in
> a interativ loop and for each file I would like to execute a
> macro script (keyin), but the problem seems to be, that the macro
> is just placed in the message queue and waits for the MDL program
> to terminate.
>
> Is there a way to get the macro to execute before the MDL program
> continues?
>
> --
> Lars Bo Wassini
> Odense Steel Shipyard, Denmark

> * Do not remove NOSPAM in e-mail *
>
>


------------------------------------------------------------------
Hungry for NEWSGROUPS??? USE feedME.ORG
Read and Post to 30,000 groups through feedME.ORG
FREE FREE FREE http://www.feedME.ORG FREE FREE FREE
------------------------------------------------------------------


0 new messages