Results 1 to 3 of 3

Thread: [2.0] Executing a set of methods (macro script)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    [2.0] Executing a set of methods (macro script)

    I'm making a macro program that takes in a script with various lines of commands such as "wait 3000", "key enter", and "click". What my program is supposed to do is take this script and execute it repeatedly, like a macro.

    First, however, my program must interpret the script and call the necessary functions. For example, if it were to parse "wait 3000", it would call the Wait method with 3000 as the arguments. If the program found the line, "key enter", it would call the SendKey method with a parameter of enter.

    However, it seems rather inefficient and cumbersome to have to re-parse the script for each iteration of the script, just to call the same methods with the same arguments. Would it be possible to have a delegate of some sort that would contain the list of methods to be called, each remembering their list of arguments? If no arguments were necessary, a delegate would seem perfect, but each method has a different signature, some requiring no arguments, such as setting the active window, and some requiring string arguments, such as sending key strokes, and then others requiring integer arguments, like that of the wait method.

    I would like to avoid having to re-parse the script each execution as each iteration would be identical and that approach seems like wasted CPU cycles. Also, I would like to avoid having a delegate with a parameter of an Object and have null arguments when the method requires no arguments and having to cast variables when there are. Also, in the future there may be multiple parameters so having a delegate of that of an Object would not be practical nor plausible.

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724

    Re: [2.0] Executing a set of methods (macro script)


  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

    Re: [2.0] Executing a set of methods (macro script)

    Thanks, works perfect.

Posting Permissions

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



Click Here to Expand Forum to Full Width