Integration into application

I've downloaded a trial Fast Script hoping to plug it into my project for automation service. There r some point that i con't figure out w/out ur help.

1. Is there a way to get access to the forms, controls & ect. of the main application from FS (not FR! *s*)

2. How 'bout the COM? I mean, is there a foreseen option to use COM. I must admit that it's not a prob to write own class under FS emunation that will support such stuff, but why should I do it if there might be one?

Lookin' forward ur reply for further colsulting.
Sincerelly, Scott

Comments

  • edited 2:08PM
    1) yes, it is possible, the main demo demonstrates this.

    just add your form class
    fsGlobalUnit.AddClass(TForm1, 'TForm');

    and any controls instance
    fsScript1.AddObject('Form1', Self);

    and you can use it in a script.

    2) COM is not supported yet, and no plans to implement it in the nearest future.
  • edited February 2004
    I??ve tried to put this code im my application, but doesn??t works like i needed.
    When i try to acess a child object from the Form declared in the source, i give a
    'Stack Overflow' exception. Can i acess the child controls in the form just placing the
    form in AddClass method ? Is there a way to do this? Ps: Sorry my bad english.

    fsScript1.Clear;
    fsScript1.AddObject('Form1', Self);
    fsScript1.Lines := Memo.Lines;
    fsScript1.SyntaxType := LangCB.Items[LangCB.ItemIndex];
    fsScript1.Parent := fsGlobalUnit;

    if the Script:

    var
    Result: string;
    begin
    Result := Form1.Label3.Caption;
    end.

    it??s compile, but on Execute gives a 'Stack Overflow' exception.
    Do i have to declare the 'Label3' object too ?
  • edited 2:08PM
    Wait for FS1.4 if you want to access Form1.Label3.
    Or, you can add Label3 object by AddObject method and access it as Label3.
  • edited 2:08PM
    When this version will be ready ? Some pre-release ?

    Thanks.
  • edited 2:08PM
    We'll upload FS1.4 as soon as possible.
  • edited 2:08PM
    Hi.

    Since i??ve been purchased the Fast Script component, i??m trying to acess the components in the Application, without sucess. I??ve tried to put:

    fsScript1.AddForm( ... )
    fsScript1.fsGlobalUnit.AddClass( ... )
    fsScript1.AddObject( ... )

    It??s compiles ok, but in the execution, gives me a 'Stack Overflow' error.

    I??m still trying to acess the components in Form1 that was referenced in the Addform method.

    fsScript1.AddForm(Form1);

    in the script:

    begin
    Form1.Caption := 'Test'; // works ok
    Form1.Label1.Caption := 'Test'; // Stack Overflow.
    end.

    Can you send me true samples of integration with the application ? Something like
    references to objects in a form (form application, not created in the Script), references to a DataBase and DataSets from DataModules, and more.

    How to reference the objects in the Form1 ?

    Can i access or atribute the events in the objects ? something like:

    begin
    Form1.Label1.OnClick := @ClickHere;
    end.

    procedure ClickHere;
    begin
    ShowMessage('You Click!');
    end;

    Sorry bad english.

    Thanks.
  • edited 2:08PM
    Do not call TfsScript.AddForm. Use fsGlobalUnit.AddForm instead. The form can be added one time.

    begin
    Form1.Label1.OnClick := @ClickHere;
    end.

    procedure ClickHere;
    begin
    ShowMessage('You Click!');
    end;

    Yes, it works.
  • edited 2:08PM
    Well, still doesnt works. ;) Couldn??t you send me an example ? He Give??s me a 'Unknown type: TLabel' exception.
  • edited 2:08PM
    You can check it in the demo at demos\main. Just write the following script:

    begin
    Form1.Label2.Caption := 'It works!';
    end.
  • edited 2:08PM
    Works ok, but the problem is that works just one time. I??m working with MDI forms, who are created at runtime. I??ve put in the onCreate event:
    procedure TForm1.OnCreate(Sender: TObject);
    begin
      fsGlobalUnit.AddForm(Form1);
    end;
    
    procedure TForm1.OnClose(Sender: TObject; var Action: TCloseAction);
    begin
       Form1 := nil; // I have to close the MDI form and recreate.
       Action := caFree;
    end;
    

    You said that the form can be added just one time. Every time i create the form, is that the problem ?

    In the next time i??ll create the MDI form, compile, execute but nothing happened.

    I thinked in a way to determine if the Form1 was already added in the fsGlobalUnit, so don??add it again... i??ve tried to put 'fsGlobalUnit.Remove(Form1)' in the close event, but dont works....

    Sorry bad english, any sugestion ?

    Thanks a lot.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.