TpaxScripter Demo. COM Support.


//---------------------------------------------------------------------------

#include 
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "PaxScripter"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  PaxScripter1->Run(rmRun, "", 0);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::PaxScripter1AssignScript(TPaxScripter *Sender)
{
  Sender->AddModule("main", paxC);
  Sender->AddCodeFromFile("main", "script.txt");
}
//---------------------------------------------------------------------------

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.