TpaxScripter Demo. COM Support.


unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    PaxScripter1: TPaxScripter;
    procedure PaxScripter1AssignScript(Sender: TPaxScripter);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  IMP_ActiveX;

{$R *.DFM}

procedure TForm1.PaxScripter1AssignScript(Sender: TPaxScripter);
begin
  Sender.AddModule('main', paxC);
  Sender.AddCodeFromFile('main', 'script.txt');
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  PaxScripter1.Run;
end;

end.

script.txt

var WordApp = new ActiveXObject("Word.Application");
WordApp.Visible = true;
print WordApp.Visible;
WordApp.Documents.Add();
var Range = WordApp.Documents.Item(1).Range;
Range.Text = "This is a column from a spreadsheet: ";
for (var I = 0; I < 3; I++)
  WordApp.Documents.Item(1).Paragraphs.Add();
Range = WordApp.Documents.Item(1).Range(WordApp.Documents.Item(1).Paragraphs.Item(3).Range.Start);
Range.Paste();


Copyright © 1999-2006 VIRT Laboratory. All rights reserved.