Delphi

From iMacros
Jump to: navigation, search

Here's how to use the Scripting Interface with Delphi 2007.

The IDE used is CodeGear's "RAD Studio for Microsoft Windows" running | "Delphi 2007 for Win32". iOpus is not affiliated with CodeGear.

Create Project

  • Create new project as "VCL Forms Application"
    1createProject.png
  • Add button that will initiate the iMacros actions
    2addButton.png

Add code to button

  • Double click button to edit its code
  • Adjust the code to read like this:
procedure TForm1.Button1Click(Sender: TObject);
begin
 with CreateComObject(CLASS_App) as IApp do begin
  iimInit ('', true, null, null, null, 60);
  iimplay('CODE:URL GOTO=http://imacros.net',30);
 end;
end;
end.

Add iMacros Scripting Interface

  • Menu -> Component -> Import Components
    3addcomponent.png
  • Import Type Library
    4importTypeLibrary.png
  • Select "iMacros Scripting Interface"
    5iMacrosScriptingInterface.png
  • Skip next window
    6noChanceNecessary.png
  • Add Scripting Interface as unit to project
    7addUnitToProject.png
  • Double click TForm1 to add references to the Scripting Interface:
    8editForm.png
  • Add Scirpting Interface (and COM object handling) to "uses" clause:
    9changeUsesClause.png

Done

  • That's it. Once being started, the software will present the form, and when the button is clicked, it starts an iMacros browser window, that visits www.iopus.com:
    10start.png