Hi Stu, Good to hear that the old version 3.0 still is used somewhere ;-)
Now to your questions: 1. You can not have an application read the parameters that are sent to MapInfo. But what I would do was to just open the table that need to be checked before running the application. In this way you can let your application look for any open table and then perform the actions on this. Or your could right the table name to a text file that the application looks for when loading, some sort of ini file. 2. I guess you can use your MapBasic as a command line compiler, even though I have never done it myself. Compile: C:\MapBasic\MapBasic 4.0\Mapbasic.Exe -D "application.mb" Link: C:\MapBasic\MapBasic 4.0\Mapbasic.Exe -L ""Application.mbp"" HTH, 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 Sidste frist for tilmelding til MapInfo Konferencen er den 6. august 2004. Tilmelding samt yderligere information kan ses p�: http://www.cowi.dk/GIS -----Original Message----- From: Cox, Stuart TRAN:EX [mailto:[EMAIL PROTECTED] Sent: Friday, August 06, 2004 7:19 PM To: [EMAIL PROTECTED] Subject: MI-L Using MapBasic as a command-line compiler A MapInfo 3.0 and MapBasic 3.02 on Windows XP (still works!) question or two. I have a project that required that I detect which polygons overlap which other polygons in a single table. I know how to do this with the technique of duplicating the table and selecting those polygons from one table that intersect others in the second table when the polygon's id's are different. This works well and produces the results I need. I'd like to modify the code so that I can use it with any tables and so that I can run it from a Startup.wor workspace without any user intervention. ------------------------ code follows -------------------------- include "mapbasic.def" declare sub main sub main Select * from MapCpy1, MapCpy2 where (MapCpy1.Obj Intersects MapCpy2.Obj) and (MapCpy1.DATA1 <> MapCpy2.DATA1) order by MapCpy1.TERRITORY, MapCpy2.TERRITORY into Overlaps open file "overlaps.out" for output as #1 fetch first from overlaps do while not eot( overlaps ) write #1, Overlaps.Col(2), Overlaps.Col(6) fetch next from overlaps loop close file #1 end sub ------------------------ code precedes -------------------------- This code requires that I call the two tables MapCpy1 and MapCpy2. It would be better if I could pass in the names of the tables to the mapbasic code both from a command line and thence into variables that are then used in the selection. What modifications should I make to this code to achieve these ends? The MapBasic manual is somewhat vague about obtaining parameters from a mapbasic application's command line. How can I access parameters from within the mapbasic code? I can startup and get MapInfo to run an .mbx by writing a Startup.wor file that resembles this example from the MapInfo help file: !workspace !version 200 run application "someprog.mbx" Where someprog.app is the name of the MapBasic application you want to launch from the startup workspace. Name this file STARTUP.WOR. Place this file in your MapInfo program directory or in your home directory. This information is also in the MapInfo help file as examples of starting up either compiled MapBasic code or starting up other workspaces: Run Application "C:\MAPBASIC\APP\REPORT.MBX" Run Application "Parcels.wor" Then, the MapInfo help file says that MapInfo launches and performs the following steps: When you run MapInfo, MapInfo does the following in the order shown: 1. If there is a STARTUP.WOR in the MapInfo program directory, it is run. 2. Then, if there is a STARTUP.WOR in your home directory it is run. (When there is a STARTUP.WOR in both the MapInfo program directory and your home directory, both are run.) 3. Then, if any file names are given on the command line or MapInfo was launched by double-clicking a document in the Macintosh Finder those file(s) are loaded. MapInfo support adding workspaces (.WOR), running applications (.APP), and opening databases (.TAB) on the command line. 4. Only if MapInfo did not add a workspace or run a program from the command line does it then check the AutoLoad preference and load MAPINFOW.WOR from the user's home directory. When the preference is set, and the file is found, it is loaded. Note that if we had a workspace or application on the command line, we skip the AutoLoad. 5. Finally, if MapInfo didn't load a workspace or run an application from the command line, and it didn't AutoLoad MAPINFOW.WOR, then MapInfo shows the Tool palette. I'd guess that the writer of this help file was last working on a Mac and left the .APP extension rather than changing it to .MBX. None of this seems to support the passing of parameters to a .MBX on the command line. Is it really so that user interaction is required to obtain the names of the .TAB files that could be supplied on a command line? As one final question, can MapBasic 3.0 be used as a command line compiler or are you forced to use it like Turbo Pascal 3.0 where you had to use the built-in IDE? Sorry for novice questions and the lengthy email. Stu Cox Project Management Technician Southern Interior Region Ministry of Transportation 523 Columbia St., Kamloops, BC V2C 2T9 p: 250-828-4320 f: 250-828-4492 [EMAIL PROTECTED] --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 12868 --------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 12871
