PDA

View Full Version : Using thinBasic macros on the fly...?



Trevor
02-09-2005, 09:03
Hi,

Something that would be very useful for me is the ability for the users of my PowerBasic application to define a mathematical algorithm at run time, and I wonder if thinBasic has the potential to allow me to do this.

For example, suppose the programme needs repeatedly to calculate the value of parameter X. In my present version of the application, I make several assumptions and go ahead with the calculation, but my assumptions restrict the usefulness of the results. I could create an elaborate interface asking the user to supply values for these assumptions, but this would be very complex and detract from the overall 'feel' I wish to maintain in the programme. Much better would be the ability for the user himself to define the algorithm (in thinBasic?) with all his own assumptions, and run this as a function or subroutine that is called from my code when needed.

The closest analogy I can think of is the running of a VBA macro to supplement the calculations of an Excel spreadsheet.

Will this remain a dream for now, or does thinBasic have the potential to grant my wish?

ErosOlmi
02-09-2005, 10:18
Hi Trevor,

thanks for your post.
Yes, thinBasic is able to do what you asked and much much more.
Unfortunatelly we still didn't release to the pubblic thinBasic interface in order to embed thinBasic into 3rd party applications. It is all ready but at the moment we are concentrated on solving bugs and developing modules.

thinBasic has a core module called thinCore.dll that contains all the logic of the interpreter plus all the links to external modules. We will release thinCore.dll to the pubblic with specifications of all library interfaces in order to be able to embed script functionalities into 3rd party applications.

More, we have already developed an SDK interface that will allow you to develop your own external modules specific for your applications. Inside these modules you will be able to implement your own language keywords working with your internal application structures. Also this is already developed: it is the SDK we day by day use to develop official thinBasic module.

Back to your needs.
Some time ago I developed a script engine dll able to interface to 3rd party application. Is is in Power Basic download area and is called BINT32. You can get it here: http://www.powerbasic.com/files/pub/pbwin/misc/
Inside there are example on how to add script engine to your applications and how implement the language. BINT32 is an old project no more supported but can give you an idea on how the the engine will work.

Also I can give you some other way to go if you need right now and cannot wait for thinBasic interface:

[list] UCalc from http://www.ucalc.com/bulletin.html
It is a fast script engine + script evaluator + much more.
Lua. Marco Pontello on his web site has Power Basic Lua interface.
See http://mark0.net/code-powerblua-e.html for Marco web site
VBScript. Jos? Rocha has VBScript wrapper for Power BAsic.
See http://com.it-berater.org/scripting.htm
[/list:u]

Well, there can be other options too. Hope the above info can solve your problem.
Let me know if I can help you further.

Regards
Eros

Trevor
02-09-2005, 13:13
Eros,

Thanks for the tips, which I'll follow up with interest.

Regards

Trevor