我正在寻找一个适用于Delphi的好用且免费的脚本引擎。我想要将脚本添加到应用程序中,以便编写小型测试脚本。具体来说,我需要:
- Pascal语法
- 当前的(我看了RemObjects Pascal Scripting,但根据我看到的帖子,它已经“过时”)。
我不需要完整的语言支持,只需要基础功能。我看到了这个:https://stackoverflow.com/questions/226135/scripting-library-for-delphi 但我认为事情已经有所改变。
我想做的就是在我的程序中添加一个备忘录组件,在运行时向备忘录添加一段源代码并单击“运行”按钮。我希望脚本能够访问我的应用程序的变量和函数。
实现这个的最简单方法是什么?下面是示例程序。
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
changelog.txt
文件。自从上次记录在该文件中以来,已经进行了许多提交
,因此我认为他们只是停止记录该文件。 - TLama