Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7745569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:03:27+00:00 2026-06-01T10:03:27+00:00

I have a DWScript like this var Outputter: TOutputter; procedure OutputterTester; begin Outputter.Print; end;

  • 0

I have a DWScript like this

var Outputter: TOutputter;

procedure OutputterTester;
begin
  Outputter.Print;
end;

TOutputter (is only a example for a complex class) is declared and created in delphi code and exposed to the DWScript via Rtti.

TOutputter = class
  procedure Print;
end;

I want to use the compiled script for several instances, but change the value Outputter that it link to current instance.
I know i can access a script variable with:

var Exec : IdwsProgramExecution;
...
AVar := Exec.Info.Vars['Outputter'].Value;

But the value is a Variant so i can’t assigne a object. How can I change the value? If i first create the class in script like:

procedure Init;
   Outputter := TOutputter.Create;
end;

I can assign Exec.Info.Vars[‘Outputter’].ScriptObj.ExtObject a arbitrary instance of TOutputter (created in delphi code) and access them in scriptcode over Outputter. But i want to assign a delphi code created instance of TOutputter without the init part.

Thank you for help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:03:29+00:00Added an answer on June 1, 2026 at 10:03 am

    If I understood correctly, you want to skip the Init procedure, but if that means you have to make Outputter either an external variable or a magic name or you won’t be able to recognize which variable it is.

    One approach for the above could be to just prepend your boiler plate code to the user script:

    var Outputter := TOutputter.Create;

    Another option would be to create an external variable in a TdwsUnit, you’ll then be responsible for creating the script-side object from the Delphi side when the user accesses that external variable, and can handle what happens if the user assign something to the variable as well.

    But if Outputter is meant to be read-only by the user, you could just declare an Outputter() function in a TdwsUnit (and create and return the script object there).

    Last option would be to use an RTTI Environment, depending on what you want to do with it, that could be the simplest option, as you can change the instance in the environment directly (one of the unit tests for RTTI environment does that).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a procedure which looks like Procedure TestProc(TVar1, TVar2 : variant); Begin TVar1 :=
Suppose I have this function saved in a certain script: function Add(a,b:integer):integer; begin result:=a+b;
have a php code like this,going to convert it in to C#. function isValid($n){
I have this JQuery function: $(document).ready(function() { $(div.descript_long).each(function() { var descript_length = $(div.descript_long).text().length; if(descript_length
have written this little class, which generates a UUID every time an object of
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
Have converted devise new session from erb to Haml but doens't work, this is
So in all my failed attempts to get jQueryUI working, I have tried this
Have some code: using (var ctx = new testDataContext()) { var options = new
have Googled the cr*p out of this one so apologies if the answer is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.