TextPad has a way of capturing output from a command-line tool, and parsing
it to locate where the compiler said the error occurred.

Unfortunately, MapBasic thwarts this capability, because the compiler always
writes compilation errors to a file with an extension of .err, even when
MapBasic is run from the command line.  If there are no errors, there is no
.err file.  

If the MapBasic compiler had a way to send errors to standard output instead
of the .err file, you could capture the output in TextPad. But it doesn't,
and MapInfo is unlikely to add this functionality.

The best you can do is to open the .err file in TextPad after compilation is
finished.  Unfortunately, there doesn't appear to be a way to make a TextPad
"tool" perform two actions. TextPad's macro functionality appears to be
limited to editing.  So you'll have to make a DOS batch file like the
following:

@echo off
if %1 == %2 goto link
mapbasic -Nosplash -D %1
goto ckerr
:link
mapbasic -Nosplash -L %1
:ckerr
if exist %3 "C:\Program Files\TextPad 4\textpad" %3

Save this in a file named MBTextPad.bat in the same directory as
Mapbasic.exe.   Then add a tool to TextPad (Configure->Preferences... Select
"tools" on the right-hand side, then Add->Program...) that runs
MBTextPad.bat.  The parameters should be 

"$FileName" "$BaseName.mbp" "$BaseName.err"

including all of the  quotes.  Make sure you have "allow multiple instances"
unchecked in Configure->Preferences General or it will open the .err file in
a separate instance.  This method will even work for MapBasic source files
whose names have spaces in them (TextPad is a little too helpful putting
quotes around parameter values with spaces in them).   Perhaps someone is
willing to write a VBScript to make this a bit less clunky.

HTH
Spencer


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Richard
Greenwood
Sent: Wednesday, July 26, 2006 8:59 AM
To: Manson, Tom, VF UK - Technology (TS)
Cc: [email protected]
Subject: Re: [MI-L] TextPad as editor for MapBasic

On 7/26/06, Manson, Tom, VF UK - Technology (TS)
<[EMAIL PROTECTED]> wrote:
>
>
>
> Keen MapBasic folk,
>
> We are investigating the use of TextPad as our editor for MapBasic. Does
> anyone have experience of this? I know that there is an add-on (on
TextPad's
> website) containing all the key words etc, but does someone have a new
> version of this? Also, how can we get the error messages to  appear, as
they
> would in MapBasic?
>
> Thanks in advance,
>
> Tom

I use Textpad all the time for MapBasic and numerous other languages.
It's an excellent editor. I have not figured out how to get the error
messages back. It has a mechanism for doing it with Java compilers, so
it should be do-able.

-- 

Richard Greenwood
[EMAIL PROTECTED]
www.greenwoodmap.com


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

Reply via email to