Access a scripter variable

Can I have access to scripter's variables from Delphi and make operations on then ?

Yes, you can use ScriptInfo.Variables property or ScriptInfo.Globals. There are several methods like FindByName, and each variable object has a Value property you can use. Note that you would mostly use Globals since Variables are only for local variables and they are only available while a local procedure is executing.


How can you use this to add a new global variable at runtime?
Is it possible to remove all the current global and local variables at once?


You can't add or remove variables from code, they are defined from script only. You can change their value, though.

Then how would you recommend the following:
Our clients uses our scripts to make documents in Word depending on the information they entered in our databases through our main program. The scripts have several variables that need to be global so the scripts can share information with each other. However, when they make a second document, there can't be any global variables initialized.
Do we need to destroy the scripter object after each merge and recreate it completely to wipe all the variables?
It would be nice if we could something like Scripter.ClearVars to wipe all the global and local variables from memory without having to re-add all our libraries again...

Not sure if I understood it completely.

If you want to clear the variable values (as you say, unintialized), then you can do that, just iterate through all global variables in all scripts, and clear their values.
But, if you want the variables to be removed, i.e., cause compile errors if a script tries to access them, then of course you must destroy the script object that contain those variables.