|
Here is a minimal Delphi project using
this code. The aw_SCtrl and AW_MSSC_TLB units can be obtained from here: http://www.btinternet.com/~a.wingrove/scripting/
Again, when tried with a VBScript/_javascript_ it
works perfectly; with a PythonScript or PerlScript it gives those OLE
exceptions.
I am using the latest ActivePerl/ActivePython
distributions from activestate.com.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, aw_SCtrl, AW_MSSC_TLB; type
TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var
Form1: TForm1; implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender:
TObject);
var s:TScriptControl; ss:TStringlist; loop:integer; stringlist:TStringlist; begin ss:= tstringlist.Create; stringlist := tstringlist.Create; // load some code from a file
ss.LoadFromFile('test.py'); s := tscriptcontrol.Create(self); s.Language :=
'Python';
s.AddCode(ss.Text);
with s.Modules['Global'] do
begin
for Loop := 1 to Procedures.Count do begin // *** EOLEException ON THIS LINE *** if (Procedures[Loop].HasReturnValue) and not (Procedures[Loop].Name[Length(Procedures[Loop].Name)] = '_') then begin StringList.Add(Procedures[Loop].Name); end; end; end;
showmessage(stringlist.Text);
ss.Free;
s.Free; stringlist.Free; end;
end.
|
_______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
