|
-
Oct 16th, 2008, 01:39 PM
#1
Thread Starter
Addicted Member
Scripting?
Hi All
I'm looking into making a program that will be able to programmatically select textboxes, click buttons etc as if a user was doing it.
I'd first like to start making a simple app which when a button is clicked will move the cursor and click/select a textbox and maybe type stuff into it.
Later i would like to add this functionality to either automate tasks in a bigger application or maybe even allow to automate tasks in another program.
Can anyone offer some advice on how to achieve this, provide some links to documentation or even tell me what I should be searching for?
Thanks
-
Oct 16th, 2008, 01:55 PM
#2
Re: Scripting?
So you basically want to create your own scripting language? That's quite a difficult task but is doable. If you're looking for a simple, proof of concept you could do something like
Code:
MyTextBox.MoveRight(20)
Then in your program you could just parse the text, use the first part (MyTextBox) to refer to the TextBox on the form, then use the 20 value and move right.
But if you want something robust (and I think that you do), what you should do is first outline exactly what you want it to do in version 1. Do you want it to be able to move and change things on a specific form? Do you want it to control things on other applications?
Once that's completed, then you need to work on the scripting language itself. Look at existing scripting language and determine what features you want to create (variables or only function calls? OOP? etc) then start working out the scripting language. Keep as consistent as possible.
Code:
OPEN Application.exe
INSERT_TEXT "Hello World!"
PAUSE 2000
CLOSE Application.exe
Once all of that is completed then you're off creating your parser. You'll need to read in all of the script and parse it into a set of commands (since scripting and programming in general is procedural; I'd recommend creating a list of what the script actually does that way it's easier to iterate through). Creating a parser is very difficult and is similar to developing your own compiler. You may want to read up on developing such systems.
One of my initial thoughts would be to read in the entire script into collections I'll call Command Sets. Each method your application contains would be a separate Command Set. Once all parsed, you would then iterate through each Command Set calling other Command Sets when needed.
It's hard to get into much further detail without knowing exactly what you're looking for but perhaps it helps. My solution isn't ideal for every situation but I also don't believe it's necessarily bad either (especially since I've had about 5 minutes to really think about it).
-
Oct 16th, 2008, 03:07 PM
#3
Member
Re: Scripting?
 Originally Posted by ^^vampire^^
I'm looking into making a program that will be able to programmatically select textboxes, click buttons etc as if a user was doing it.
SendMessage can perform a lot of the actions you are looking for.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|