Hi Jim and Bjorn,
You can get this sort of thing to run from Mapbasic, by using 'run
program...'. The only problem is that mapbasic doesn't wait for the DOS
batch file to be executed - if you don't pause your mbx, then your code will
probably try to do something with the output from the batch file before it's
been created.
Clear as mud? Example code below - this creates a DOS batch file to list all
jpegs in str_directory to a file called list.txt:
open file "c:\mapinfo\airphoto\list.bat" for output as #3
print #3,"dir /b "+str_directory+"\*.jpg > c:\mapinfo\airphoto\list.txt"
close file #3
run program "c:\mapinfo\airphoto\list.bat"
note "Click this button to continue" ' this pauses the mbx long enough for
list.bat to run
' (unless you're really fast with the
mouse, or the batch
' file runs really slowly!)
kill "c:\mapinfo\airphoto\list.bat"
- the next stage would be to open list.txt as an ascii file in mapbasic and
do things with its content (oo-er!).
If anyone with more knowledge of DOS and/or mapbasic has a more elegant
solution, then I'd be very interested.
Hope this helps,
---------------------------------------------
David Booth
Senior GIS Officer
Merseyside Information Service
> -----Original Message-----
> From: "Grasnick, Björn" [SMTP:[EMAIL PROTECTED]]
> Sent: 12 January 2001 09:36
> To: Jim Wilson; [EMAIL PROTECTED]
> Subject: AW: MI-L Batch process text files
>
> Hi Jim,
>
> I'm not too familiar with MapBasic but I'm using an MBX (written by
> someone
> else) that gets filenames out of a table that the program creates from a
> txt
> file that in turn got created by a DOS command line command:
>
> DIR *.txt /b > filenames.txt
>
> This command for example would get the names of all *.txt files in a new
> txt-file, separated by newlines. You than may register this txt-file as a
> table and process its rows. I don't know if you could get MapBasic run
> this
> DOS command, I'm actually doing it separately.
>
> Regards,
> Bjoern
>
> -----Ursprüngliche Nachricht-----
> Von: Jim Wilson [mailto:[EMAIL PROTECTED]]
> Gesendet am: Freitag, 12. Januar 2001 08:56
> An: [EMAIL PROTECTED]
> Betreff: MI-L Batch process text files
>
> Hi all,
> I am writing a MB program to process a txt file which works ok now but as
> I
> have a lot of txt files to process I would like to be able to select
> multiple txt files at one time and have the program process them one after
> another. I was planning to select the multiple files from the FileOpenDlg(
> )
> function (as you are able to do in MapInfo) however no matter if I press
> the
> shift or Ctrl keys, I can only select 1 file at a time.
>
> I also looked at a MBX called Batch Tools from Computamaps and it allows
> you
> to select one file then it searches for all the files of a similar type in
> the same directory.
>
> I think I see how I would embed my current code in a loop and then select
> the different tablenames one by one from a "batchcontroltable" but how do
> you get the file names into the batchcontroltable in the first place?
>
> TIA
>
> Jim Wilson
>
>
>
> _______________________________________________________________________
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, send e-mail to [EMAIL PROTECTED] and
> put "unsubscribe MapInfo-L" in the message body.
>
>
> _______________________________________________________________________
> List hosting provided by Directions Magazine | www.directionsmag.com |
> To unsubscribe, send e-mail to [EMAIL PROTECTED] and
> put "unsubscribe MapInfo-L" in the message body.
_______________________________________________________________________
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, send e-mail to [EMAIL PROTECTED] and
put "unsubscribe MapInfo-L" in the message body.