[Gambas-user] Executing a constructed instruction

Charlie karl.reinl at ...9...
Sun Jun 13 21:05:28 CEST 2004


Nigel Gerrard schrieb:

> Has anybody got an idea how I might run a string as a command within 
> Gambas.
>  
> For example:
>  
>       DIM sCommand AS String
>  
>       sCommand = "PRINT \"Hello\""
>  
>       sCommand
>  
>  
> I'm guessing that it won't be possible without many changes to the 
> pcode compiler
> and interpreter....and I guess it would get verycomplicated.
>  
> Nigel

Salut Nigel,

try to go with gb.eval
like this:

' Gambas module file
PUBLIC SUB Main()
DIM hExpression AS NEW Expression
  PRINT "use gb.eval"
  PRINT "    hExpression.Text = ' 10 + 11 + 53'"
  hExpression.Text =" 10 + 11 + 53"
  PRINT "    hExpression.Text result = " & hExpression.Value
  PRINT " and see also Examples/Evaluator "
  STOP
END


This is not as powerfull as Clipper 'Macros' was, but it is a beginning.

Amicalement
Charlie








More information about the User mailing list