Results 1 to 18 of 18

Thread: SCARInternals

  1. #1
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default SCARInternals

    SCAR Code:
    program New;
    var
      i, j, k, total: integer;
      ax: TCOMPONENT;
      TerminateBTN, DoSomethingBTN: TBUTTON;
      pop: TPOPUPMENU;
      popOpt1: TMenuItem;
      DEAD: Boolean;

    procedure updRes;
    begin
      GetApplication.MAINFORM.CAPTION := IntToStr(GetSelf.Height) + ' x ' + IntToStr(GetSelf.Width);
    end;

    procedure onRes(Sender: TObject);
    var
      vars: TVariantArray;
    begin
      ThreadSafeCall('updRes', vars);
    end;

    procedure doSomething(Sender: TObject);
    begin
      GetApplication.MESSAGEBOX('Something has been done!', 'CONGRATULATIONS!', 0);
    end;

    procedure Term(Sender: TObject);
    begin
      DEAD := true;
      GetSelf.Invalidate;
    end;

    begin
      ClearDebug;
      GetSelf.ONRESIZE := @onRes;
      total := GetApplication.MAINFORM.COMPONENTCOUNT;
      writeln(inttostr(total));
      for i := 0 to total - 1 do
      begin
        writeln(inttostr(i) + ': ' + GetApplication.MAINFORM.COMPONENTS[i].NAME);
        if(GetApplication.MAINFORM.COMPONENTS[i].COMPONENTCOUNT > 0) then
          for j := 0 to GetApplication.MAINFORM.COMPONENTS[i].COMPONENTCOUNT - 1 do
          begin
            writeln('   ' + GetApplication.MAINFORM.COMPONENTS[i].COMPONENTS[j].NAME);
     //       ax :=
          end;
      end;

      DoSomethingBTN := TButton.Create(GetApplication.MAINFORM);//.FindComponent('Panel1'));
      DoSomethingBTN.Parent := GetApplication.MAINFORM//.FindComponent('Panel1');
      DoSomethingBTN.Left := 245;
      DoSomethingBTN.Top := 1;
      DoSomethingBTN.Width := 75;
      DoSomethingBTN.Height := 20;
      DoSomethingBTN.Caption := 'Do Something';
      DoSomethingBTN.Visible := true;
      DoSomethingBTN.ONCLICK := @DoSomething;

      TerminateBTN := TButton.Create(GetApplication.MAINFORM);//.FindComponent('Panel1'));
      TerminateBTN.Parent := GetApplication.MAINFORM//.FindComponent('Panel1');
      TerminateBTN.Left := 201;
      TerminateBTN.Top := 26;
      TerminateBTN.Width := 121;
      TerminateBTN.Height := 20;
      TerminateBTN.Caption := 'Terminate';
      TerminateBTN.Visible := true;
      TerminateBTN.ONCLICK := @Term;

      popOpt1 := TMenuItem.Create(GetApplication.MAINFORM);
      popOpt1.Caption := 'Terminate';
      popOpt1.ONCLICK := @Term;

      pop := TPopUpMenu.Create(GetApplication.MAINFORM);
      pop.ITEMS.ADD(popOpt1);

      GetApplication.MAINFORM.POPUPMENU := pop;

      repeat
        wait(50);
        GetApplication.PROCESSMESSAGES;
        GetApplication.HANDLEMESSAGE;
      until(DEAD)

      try
        pop.Free;
        popOpt1.Free;
        DoSomethingBTN.free;
        TerminateBTN.Free;
      except end;
    end.


    What it does:
    • Extracts a list of all children components of the main SCAR form
    • Adds two buttons and a right-click menu to SCAR
    • Try resizing the window


    SCAR 2.03
    [Apparently I'm not allowed to link to SCAR...]
    Last edited by Smartzkid; 06-01-2009 at 11:48 PM.
    Interested in C# and Electrical Engineering? This might interest you.

  2. #2
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    I didn't try it, but it sounds pretty cool

  3. #3
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Well, its completely useless because of the old-SCAR requirement, but it's definitely interesting
    Interested in C# and Electrical Engineering? This might interest you.

  4. #4
    Join Date
    May 2006
    Location
    Amsterdam
    Posts
    3,620
    Mentioned
    5 Post(s)
    Quoted
    0 Post(s)

    Default

    Yeah, unfortunately this is one of the things Freddy removed in the first version of DiVi :-(
    Verrekte Koekwous

  5. #5
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    'Vulnerabilities'
    Interested in C# and Electrical Engineering? This might interest you.

  6. #6
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    what exactly is happening here. Installing 2.03 would sadden me.
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  7. #7
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by Dan Cardin View Post
    what exactly is happening here. Installing 2.03 would sadden me.
    If you read the thread you would see that it has been removed after SCAR 2.03.



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  8. #8
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    He's asking what it does, I believe. And he doesn't want to install SCAR 2.03, I'm also assuming. :]

  9. #9
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Aight, aight, I uploaded SCAR & script in a very simple archive file (top post). Maybe now I can get some reactions (*cough* just make sure you tell Freddy how amazing it would be to still be able to do this!)
    Last edited by Smartzkid; 06-01-2009 at 11:51 AM.
    Interested in C# and Electrical Engineering? This might interest you.

  10. #10
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Got an access violation when I right clicked - Terminate then tried to resize the window.. :] cool though.

    Full size - Right click - Terminate - Double click to reduce size

    makes my SCAR crash anyways

    Or if you pause it then when it's paused right click - terminate it crashes

    or if you pause it at all. haha
    Last edited by ian.; 06-01-2009 at 12:03 PM.

  11. #11
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    Pretty cool, but it gave me a bunch of errors when I tried to exit the program.

  12. #12
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    And senrath, that doesn't sound very profound

  13. #13
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    Pretty cool indeed. Would be fun if you used this to add buttons to let users set up your script.

  14. #14
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by Wizzup? View Post
    If you read the thread you would see that it has been removed after SCAR 2.03.
    lol

    I actually didnt get any errors. That was quite interesting. I could think of this being abused by people, but i guess it would work just like malicious code now, people realize it right away and their script gets not used. Otherwise i dont really see how its a vulnerability.

    It is interesting, however i dont really see a large use for it. Unless this Making a small form would probably amount to just as much work. Unless the changes persisted until SCAR was closed, i dont see it being used much. Can anyone think of somewhere where this would be useful?
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  15. #15
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    I could see various scripting utilities integrating with SCAR, which would be convenient; you would be able to script alongside, say, ACA.

    I'm not sure if it could be done, but if we were to have access to the script as it was being written, it would open all sorts of doors - backup on every change, warnings for unfreed resources, on-the-fly SRL procedure description viewer, etc.
    Interested in C# and Electrical Engineering? This might interest you.

  16. #16
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    but everything goes away once the script is terminated = my point
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


  17. #17
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Yeah. You would run the helper script, then switch to your actual script with the helper still running in the background.
    Interested in C# and Electrical Engineering? This might interest you.

  18. #18
    Join Date
    Apr 2007
    Posts
    3,152
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    since when can you run 2 scripts from the same scar window? or edit code while running. I could see editing code while a script is running being bad. Along with it being kind of pointless if you could, for then you would kinda need to be able to run multiple at once. For the most part being something that would probably remain unused for the majority of scripts (assuming that it wouldnt lead to bad things in the first place).
    SCAR Tutorials: The Form Tutorial | Types, Arrays, and Classes
    Programming Projects: NotePad | Tetris | Chess


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •