Just curios if anyone actually have had any success with the GetCommandLine() 
function ?

I have declared it like this:
Declare Function GetCommandLine Lib "kernel32" Alias "GetCommandLineA" () As 
String

and then I can use it like this (just to see if it actual works):
Print "GetCommandLine: " & GetCommandLine()

But if I try to send more parameters to MapInfo than just the application file 
I'm told that MapInfo cnot was able to open the file "my parameter value". So 
MapInfo tried to access my parameter as if it was a file... How can this be 
prevented ?

Another thing is that you need to run MapInfo with the application as 
parameter. You can't just run the application because MapInfo then starts in a 
different way. I guess Window looks in the registry for the application to run 
the MapBasic application and there you might find some other values as well.

Any thoughts ?

Peter Horsb�ll M�ller
GIS Developer
Geographical Information & IT
 
COWI A/S
Odensevej 95
DK-5260 Odense S.
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk/gis


-----Original Message-----
From: Darrin Clement [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 25, 2005 1:33 PM
To: 'MapInfo List'
Subject: MI-L SUM: running mbx from command prompt


Thank you to all who responded to my original post on how to call only a 
particular subroutine in an mbx (see original below).  Unfortunately, I have 
not had a chance to test all of them out but I wanted to summarize because if I 
wait too long, I'd forget to do it!

The simple answer is that what I was seeking could not be done the way I had 
hoped.  But there are some good approaches worth trying:

1) use the getcommandline API call
2) do it in two programs - one that creates a text file with the name of the 
subroutine and any parameters, then a second that reads in that text file to 
mapbasic and executes accordingly
3) use DDE or OLE (for example, though VB) to control the MapBasic program

Simply because of my own comfort level, #2 will work best for us.

Thanks to Peter Horsb�ll M�ller, Bill Thoen, Robert Crossley, Phil Waight, Gary 
Searles, and Martin Hodder for all their guidance.

Darrin
-----Original Message-----
From: Darrin Clement [mailto:[EMAIL PROTECTED]
Sent: Tuesday, April 19, 2005 2:09 PM
To: 'Robert Crossley'
Cc: 'MapInfo List'
Subject: RE: MI-L running mbx from command prompt

Our code is indeed MapBasic and the passing of parameters isn't really the 
issue (we know that part).  It's that we want to be able, from a dos batch 
script, to call specific subroutines of the mapbasic code.  If each sub were 
it's own .mbx, this would be no problem.  But since there are ~20 different 
subs in the .mbx, we would like to be able to call just the right one from DOS.

One idea we have is to actually pass the name of the subroutine as a parameter 
of main - but that seems to violate basic programming rules.

If anyone has further insight, please let me know and I will summarize for the 
group if there is a solution.

Thank you.

Darrin
www.maponics.com 

On Mon, 18 Apr 2005 09:12:37 -0400, Darrin Clement  
<[EMAIL PROTECTED]> wrote:

>  Hello,
>
> We have a complex piece of code that generates a button pad.  When the 
> user then selects a button, it calls the appropriate subroutine 
> procedure
> which
> then prompts for a few input parameters.
>
> Is there a way to call such a subroutine (procedure), while passing
> the input parameters, from the command line?  Maybe using switches or
> something?
> For example:
>
> Run testprogram.mbx /subroutine1(input1,input2)
>
> I'm not really asking about the passing of parameters but more the act
> of calling a subroutine from a command line.  Any help?
>
> Thank you!
>
> Darrin
>
>
>
> ..........
>
> www.maponics.com   www.maponicsonlinestore.com 
> C 2005.  Note: The information contained in this message is privileged 
> and confidential and may be protected from disclosure and forwarding. 
> If the reader of this message is not the intended recipient, or an 
> employee or agent responsible for delivering this message to the 
> intended recipient,
> you
> are hereby notified that any dissemination, distribution or copying of  
> this
> communication is strictly prohibited. If you have received this
> communication in error, please notify us immediately by replying to the
> sender named above and deleting this message from your computer. Thank  
> you.



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com | To 
unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16215



---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 16236

Reply via email to