Questions tagged [dwscript]

DWScript is an object-oriented scripting engine for Delphi based on the Delphi language, with extensions borrowed from other Pascal languages (FreePascal, Prism, etc.).

DWScript (Delphi Web Script) is an object-oriented scripting engine for Delphi based on the Delphi language, with extensions borrowed from other Pascal languages (FreePascal, Prism, etc.). It introduces a few Pascal language extensions of its own as well.

DWScript is an open-source project, issues that do not pertain to DWScript programming, usage or integration in host applications are probably best reported in the issue tracker.

93 questions
1
vote
1 answer

Delphi Web Script: How to call global TForm object's property in script?

I've registered TForm class and its 'caption' property, then I register a global variable: NewGlobal := DwsUnit.Variables.Add; NewGlobal.Name := 'MainForm'; NewGlobal.DataType := 'TForm'; NewGlobal.OnReadVar := GlobalReadProc; GlobalReadProc…
1
vote
0 answers

DWScript: Possible bug in TdwsFileNotifier

In procedure TdwsFileNotifier.Execute, when ReadDirectoryChanges call fails, the thread is terminated by calling Terminate but the loop is not immediately exited. IMO there should be a break immediately after Terminate like this: FActive:=True; …
fpiette
  • 11,983
  • 1
  • 24
  • 46
1
vote
1 answer

DWScript: exposing and returning an object to script from Delphi function?

In my Delphi (2010) code I have a class TImageItem, which I have exposed to DWScript via: dwsUnit.ExposeRTTI(TypeInfo(TImageItem),[eoNoFreeOnCleanup, eoExposePublic]); In dwsUnit I have declared a function to get a TImageItem from the Delphi…
hukka
  • 13
  • 3
1
vote
0 answers

DWScript set TFormStyle property on external TForm instance

I try to set some properties on a TForm instance that is "injected" into the script using TdwsRTTIConnector and the funcion: procedure TForm1.OnFunctionEval_ConnectForm(info: TProgramInfo); var c:TComponent; begin c :=…
jamesgza
  • 11
  • 2
1
vote
1 answer

How to install DWScript

I am trying to install DWScript into Delphi XE4: (I did copy the package files into a DelphiXE4 folder and change the package suffix property to XE4...) In the packages folder there are 3 files: dwsLibRuntime.dpk dwsLib.dpk dwsLibDesignOnly.dpk I…
RaelB
  • 3,301
  • 5
  • 35
  • 55
1
vote
1 answer

Use Script RTTI in DWSWebServer

At the moment I'm playing a little bit with the DWSWebServer. I really like the idea of coding dynamic websites with a pascal style language. Now I would like to implement a simple ORM using the script-side-RTTI. But the scriptcompiler does not…
1
vote
1 answer

How to get rid of JSON unicode literals in Delphi/dwsJSON?

I have a piece of JSON in UTF-8 that looks like this in Google Chrome (without the new lines): {"_links": {"self": {"href": "http://bla:8888/1/2/3/2257487e4a750cab"}, "it\u0119m": [{"href":…
Thijs van Dien
  • 6,516
  • 1
  • 29
  • 48
1
vote
0 answers

Adding strongly typed RttiVariant from Delphi to expose to DWS script

I'd like to get some compile time checking on my scripts so exposing my global variables as just RTTIVariant is not desirable. I'm exposing the Screen object to script using the following code. Delphi side global variable creation var CompVar :…
Tom Robertson
  • 151
  • 10
1
vote
1 answer

DWScript: TdwsGuardianThread.Finalize freeze when inside a DLL

When dwsExprs is added to a DLL, his finalization section freeze. Actaully TdwsGuardianThread.Finalize is frozen on the line guardian.WaitFor. To demonstrate the issue, I made a sample DLL, which is empty and only include dwsCript. I also made a…
fpiette
  • 11,983
  • 1
  • 24
  • 46
1
vote
1 answer

DWScript: Issue updating to current development version

This weekend, I updated my code base from DWScript SVN. I used Preview 2.7 and now I'm using up-to-date trunk version. I recompile my application and now the OnAfterInitUnitTable is no more triggered. Actually TdwsUnit.InitUnitTable is not called…
fpiette
  • 11,983
  • 1
  • 24
  • 46
1
vote
1 answer

dwsscript Invalid Operands

I'm getting a compilation error "Invalid Operands" when compiling my dws script with RTTIVariable types. Is it possible for the following to work? Declare variable which is a form. gVar := ScriptUnit.Variables.Add; gVar.Name :=…
Tom Robertson
  • 151
  • 10
1
vote
0 answers

Injecting interface implementation into script

How one is supposed to "inject interface implementation" into script? Say I define an interface type in TdwsUnit, like IFoo = interface procedure Bar; end; now how can I implement an function which returns array of IFoo (or List of IFoo or even…
ain
  • 22,394
  • 3
  • 54
  • 74
1
vote
2 answers

Use dwscript as a plugin framework for Delphi Application

Is there a way to use dwscript as a plugin framework for a Delphi app? Eg I have a simple method in dwscript that adds to numbers and this needs to be called from the hosting application. One solution is to leave the dwscript as a text file and…
rhody
  • 2,274
  • 2
  • 22
  • 40
1
vote
1 answer

Using a TdwsUnit implicitly

Is assigning the TDelphiWebScript object to the TdwsUnit's Script property sufficient to use it implicitly? (Without having to add it to uses in the script)
FHannes
  • 783
  • 7
  • 22
1
vote
1 answer

Record methods in TdwsUnit

Is there a way to add methods to records in a TdwsUnit? It seems the members property only allows you to add fields. And is it possible to register constructors as well?
FHannes
  • 783
  • 7
  • 22