Ronan,

 

Although I agree with Matt’s earlier comment regarding your post, I occasionally use the following method:

 

It’s a workspace, which starts a mapbasic program and then  “feeds” the program with arguments. I use it to “start MapInfo with a MapBasic program and command-line parameters” from a windows shortcut or from a batch file.

 

Workspace (simple.wor)

++++++++++++++++++++

!Workspace

!Version 600

!Charset WindowsLatin1

 

Run application "simple.mbx"

dim n as integer

n = DDEInitiate("MapInfo","simple.mbx")

DDEExecute  n, "1. argument"

DDEExecute  n, "2. argument"

undim n

++++++++++++++++++++

 

Program (simple.mb)

++++++++++++++++++++

include "mapbasic.def"

Declare Sub Main ()

Declare Sub RemoteMsgHandler ()

 

Sub Main ()

' Do nothing here..

End Sub

 

Sub RemoteMsgHandler

 

  Dim sArg as string

  sArg = CommandInfo(CMD_INFO_MSG)

 

' Do something with the argument here..

  print sArg

 

' if MapInfo must be stopped

' after processing the argument

' then uncomment the next line

'  End MapInfo

 

End Sub

++++++++++++++++++++

 

The method demonstrates how to use DDE from a MapBasic program.

 

Regards

 

Bo Thomsen

GeoConsult I/S

 


Fra: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] På vegne af Ronan Moriarty
Sendt: 17. november 2005 17:20
Til: [email protected]
Emne: [MI-L] Passing command line parameters to mbx's.

 

Hi All,

 

I’m writing an mbx for MapInfo 6.5 to save a large number of maps as image files. I want to add scalebars to each map, so I intend to run ScaleBar.mbx (Version 3.5) from my own mbx. Once the scale bar is added to the Mapper window, I intend to move the scale bar objects for each image being saved, so that they appear on each map image created (the scale of all the images are going to be the same!). I feel that automating the addition of the scalebar would be the ideal approach, as I need to standardise the maps as much as possible, so the less user-interaction the better.

 

What I would like to know is if there is any way of passing “command line parameters” to Scalebar.mbx from my mbx, so that the dialog doesn’t have to be displayed and the scale bar properties can be set and the scale bar can be added automatically. Alternatively, maybe I could use DDE to achieve a similar result? At a glance, it would appear that I could edit the Scalebar.prf file to change the scale bar settings, but without documentation, it could involve a large amount of trial and error!

 

Also, if either of these approaches are possible, I need to find documentation on the command line parameters / DDE requests to use! Again, the program is ScaleBar.mbx and it’s version 3.5.

 

Thanks in advance,

 

Ronan Moriarty.

 

_______________________________________________
MapInfo-L mailing list
[email protected]
http://www.directionsmag.com/mailman/listinfo/mapinfo-l

Reply via email to