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 *
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);
> 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
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.
>
I keep getting the mesage:
"MDL detected invalid use of suspend."
I do use the -csoff switch in the link!
--
Lars Bo Wassini
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>...
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
-----------------------------------------------------------------
-------
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.
> 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
------------------------------------------------------------------