FastScript in Delphi XE8 - Works in 2006, Any tips to make it work in XE8? [Edit]

I am converting from Delphi 2006 to Delphi XE8, and am now nearing the finish line, but have one remaining major roadblock: FastScript

I use Fastscript very heavily as a way to allow our users to write scripts that can extend our software as much as they like, including creating forms and adding buttons.  This is not working.

A specific problem that I have, is that code that works great in Delphi 2006 does not work in Delphi XE8.  Specifically, if my script contains a reference to a "TForm", or "TBitBtn" (as well as many other components), then FastScript will return an error at runtime of "Unknown Type 'tBitBtn'" or "resource TForm not found".

I suspect that maybe unit names have perhaps changed, and I'm not including whatever defines TForm, TBitBtn, and other such items for FastScript.

Anyone else experience similar issues?  Any tips here?

Thanks!

Carl.

PS: Below is a simple test application that shows the problem.

{code}
unit FastScriptTestUnit;
{
  Test of converting a Delphi 2006 FastScript project to work in Delphi XE8.
  This unit works great in Delphi 2006.  It gives error in Delphi XE8.
}
interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,
  {Fast Script items needed to run this script below.}
  fs_iinterpreter, fs_ipascal;

type
  TForm2 = class(TForm)
    fsScript1: TfsScript;
    fsPascal1: TfsPascal;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation
uses
  fs_iCpp,fs_iBasic,fs_iJS,
  FS_iClassesRTTI,FS_iGraphicsRTTI,FS_iFormsRTTI,FS_iExtCtrlsRTTI,
  FS_iDialogsRTTI,FS_iDBRTTI,FS_iDBCtrlsRTTI,FS_iBDERTTI,FS_iADORTTI,
  fs_imenusrtti;

{$R *.dfm}

procedure TForm2.FormCreate(Sender: TObject);
var
  TempScript:tfsScript;
  ScriptLines:TStringList;
begin

  {Create the Script Engine.}
  TempScript:=tfsScript.Create(Self);
  TempScript.Clear;
  TempScript.Parent:=fsGlobalUnit;

  {Create a temporary script to run.}
  ScriptLines:=TStringList.Create;
  ScriptLines.Clear;
  ScriptLines.Add('var');
  ScriptLines.Add('  MyForm:TForm;');
  ScriptLines.Add('begin');
  ScriptLines.Add('  MyForm:=TForm.Create(nil);');
  ScriptLines.Add('  MyForm.ShowModal;');
  ScriptLines.Add('  MyForm.Free;');
  ScriptLines.Add('end.');

  TempScript.Lines:=ScriptLines;

  {Run the script.}
  if TempScript.Compile then
  begin
    TempScript.Execute;
  end
  else
  begin
    ShowMessage('Script did not compile'+#13+
                'Error line: '+TempScript.ErrorPos+#13+
                'Error Message: '+TempScript.ErrorMsg);
  end;

  {Free up stuff.}
  TempScript.Free;
  ScriptLines.Free;

end;

end.
{code}

Edited by: Carl Olsen on Jul 7, 2015 2:36 PM
0
Carl
7/7/2015 9:37:25 PM
📁 embarcadero.delphi.tools
📃 5366 articles.
⭐ 3 followers.

💬 0 Replies
👁️‍🗨️ 2173 Views

Reply: