>From my experience, the Run Command statement works just like the MapBasic
Window, which means that you can't use functions or subroutines.  However, you
can use the Dim statement, but you can't Dim arrays.  So a work around for
arrays would be something like this:

For i = 1 to NumElements
    Run Command "Dim ArrayElement" + Str$(i)
Next
'this gives you variables:
'ArrayElement1, ArrayElement2, etc.,

I'm fairly certain that any variables that you 'Dim' using the Run Command
statement end up in the MapInfo global space (as opposed to your MapBasic
program's global space) which means that they are visible from other mbx's as
well as the MapBasic Window (I used this handly little feature to write an mbx
that creates a bunch of variables with the names and values of the constansts
defined in the MapBasic.def so I could use them from the MapBasic window).
However, this means that you are tying up global memory resources and once the
variables exist, if you try to create them again (i.e., by running your mbx
again) you will get an error.  Therefore, you should end your program by using
the 'UnDim' statement to get rid of any variables that you 'Dim'ed.  So, for the
above example, you would:

For i = 1 to NumElements
    Run Command "UnDim ArrayElement" + Str$(i)
Next


Hope this helps,
Gary.

Mapmail wrote:

> Hello everyone
>
> I have a question concerning MapBasic.
> When using 'Run Command', is there a way to use the statements 'Call', 'Dim'
> and 'ReDim' as the command ?
> e.g.
> Str1 = "Call "
> Str2 = "Myfunction"
> Run Command Str1+Str2
>
> or e.g.
> Str1 = "Dim "
> Str2 = "Myarray(10) as string"
> Run Command Str1+Str2
>
> I have not succeded, but maybe I'm doing something wrong.
>
> Thank you in advance
>
> J.I.Dali
>
> ----------------------------------------------------------------------
> To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to