Windows Automation

BlitzPlus Forums/BlitzPlus Programming/Windows Automation

Tyler(Posted 2005) [#1]
Is there any way to have a program move the mouse, click the mouse, move the mouse again, click, enter text, click, etc? My place of business wants me to create an automation program to take away some tedious tasks. Any ideas?


Grey Alien(Posted 2005) [#2]
You can position the mouse cursor anywhere with blitz but only within a blitz app. If you were writing an app in blitz you could automate it much better anyway. I presume you mean to automate a different program in which case I don't think blitz will let you move the mouse over a different application, but I could be wrong.


JoshK(Posted 2005) [#3]
You can move the mouse, but I am not sure if you can force a mouse click event.


VIP3R(Posted 2005) [#4]
Sounds like a real bad idea to me, can't you do it any other way? :)

What application are you trying to automate?


Kevin_(Posted 2005) [#5]
There is a function in User32.dll called 'SetCursorPos' that allows you to move the mouse cursor around the screen even though it maybe outside the border of your application.

Not sure about the mouse click though. If you are trying to control another app you'll have to keep control of your active windows because clicking once will only make the selected window active and won't select a button for example if thats what you want to do.

Do some research on 'macros'.


Tyler(Posted 2005) [#6]
It's a set of applications that needs automating. Renaming utitlity, stitching software and that's about it. Thanks for the help so far! I know there used to be a program called "GhostSurf" that let you surf sites while you weren't home (for those popular surf the net and get money schemes) It took a list of websites from a text document, and went to work ... all you had to do was click once on your open browser's address bar, and it would move the mouse a little randomly, then move it up to the bar, click, type in an address, hit enter, then do it all over again every 2 minutes or so. Possible, just not sure how (or how with Blitz). Thanks again everyone.


Kevin_(Posted 2005) [#7]
Here's maybe one solution that would work best with a really high resolution desktop.

Open all the apps you need in their own space on the desktop.
Run BlitzPlus and set the buffer as the desktop.
Minimize BlitsPlus after running a program to 'record' the mouse cursor position, the mouse clicks and any keypresses.
This is basically a very crude macro system.
Record the activity into a file so that it will loop over and over again. Its important to get the order correct for your activities and the window positions of your other apps otherwise it could cause errors.
Once you have a data file that is basically a recording of your activity, then all you have to do is run it - Just interpret the data in the file.

Thats the theory anyway. I find it very interesting actually, might have a go at doing one myself.


VIP3R(Posted 2005) [#8]
Hey Tiler, have you tried this?

http://www.blitzmax.com/codearcs/codearcs.php?code=1186


Tyler(Posted 2005) [#9]
... ::jaw drop:: That's the one! Thanks! ::Bows down before VIP3R::


Beaker(Posted 2005) [#10]
If you aren't stuck on using BlitzPlus then I recommend you use AutoHotKey for the task. Its specifically made for this type of task.