Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good scripting Pascal-like language for Delphi?

I'm looking for a good free scripting engine for Delphi. I want to add scripting to an application so that I can write small test scripts. Specifically I need:

  • Pascal-like syntax
  • current (I looked at RemObjects Pascal Scripting but it is "obsolete" according to a posting I saw).

I don't need full language support, just the basics. I saw this: https://stackoverflow.com/questions/226135/scripting-library-for-delphi but I'm assuming things have moved on a little since then.

All I want to be able to do is add a memo component to my program, and at run-time add a fragment of source to the memo and click on a go button. I want the script to be able to access my application's variables and functions.

What's the easiest path to accomplishing this? Example program follows.

program Project31;

uses
  Forms,
  Unit36 in 'Unit36.pas' {Form36};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm36, Form36);
  Application.Run;
end.

.

unit Unit36;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm36 = class(TForm)
    Button1: TButton;
    Memo1: TMemo;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form36: TForm36;

implementation

{$R *.dfm}

procedure RoutineInMyApplication ;

begin
ShowMessage ('Hello from my Application') ;
end ;

procedure TForm36.Button1Click(Sender: TObject);
begin
//ExecuteScript (Memo1.Lines) ;
end ;

end.

.

object Form36: TForm36
  Left = 0
  Top = 0
  Caption = 'Form36'
  ClientHeight = 174
  ClientWidth = 391
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Button1: TButton
    Left = 300
    Top = 72
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 0
    OnClick = Button1Click
  end
  object Memo1: TMemo
    Left = 8
    Top = 21
    Width = 241
    Height = 145
    Lines.Strings = (
      'begin'
      'ShowMessage  ('#39'Hello world'#39') ;'
      'CallSomehow (RoutineInMyApplication) ;'
      'end.'
      ' ')
    TabOrder = 1
  end
end
like image 777
rossmcm Avatar asked Sep 10 '12 00:09

rossmcm


1 Answers

enter image description here


Release Notes maXbox 4.7.5.20 Jan 2021 mX47


Add 25 Units + 4 Tutorials

1277 unit uPSI_SystemsDiagram.pas  Dendron
1278 unit uPSI_qsFoundation.pas    Dendron
1279 uPSI_JclStringLists2          JCL  
1280 uPSI_cInternetUtils2          FLC
1281 uPSI_cWindows.pas             FLC
1282 uPSI_flcSysUtils.pas  +TBytes utils
1283 unit uPSI_RotImg.pas          DA 
1284 uPSI_SimpleImageLoader.pas    LAZ
1285 uPSI_HSLUtils.pas             LAZ
1286 uPSI_GraphicsMathLibrary.pas  EF
1287 unit uPSI_umodels.pas         DMath
1288 uPSI_flcStatistics.pas        FLC5
1289 uPSI_flcMaths.pas             FLC5
1290 uPSI_flcCharSet.pas
1291 uPSI_flcBits32.pas
1292 uPSI_flcTimers.pas
1293 uPSI_cBlaiseParserLexer.pas
1294 uPSI_flcRational.pas
1295 uPSI_flcComplex.pas
1296 unit uPSI_flcMatrix (uPSI_flcVectors.pas)
1297 unit uPSI_flcStringBuilder.pas
1298 unit PJResFile_Routines;
1299 uPSI_flcASCII.pas
1300 uPSI_flcStringPatternMatcher;
1301 unit uPSI_flcUnicodeChar.pas

Totals of Function Calls: 33282 SHA1: of 4.7.5.20 D82EAD01C58738887661428F94B207DB1D8FAEB5 CRC32: 768395C5 29.5 MB (31,012,768 bytes

like image 126
Max Kleiner Avatar answered Sep 28 '22 17:09

Max Kleiner