Help with script

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
henryuscola
Newbie
Posts: 2
Joined: Mon Dec 15, 2014 8:28 am

Help with script

Post by henryuscola » Mon Dec 15, 2014 8:38 am

Hi all ok basically i have a good script going but one thing I have no idea of getting the macro to do is;
1- Randomly hover mouse inside this window looking for an object.
2- if mouse finds a specific text on the top left of the window after hovering around it, clicks on the object.
Any ideas?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Help with script

Post by Marcus Tettmar » Mon Dec 15, 2014 11:25 am

By randomly do you mean a random position within the window?

If so you could use GetWindowSize to get the width and height, then Random to get a random value within those dimensions, then apply to position of window to make a mouse position. E.g. with Notepad we could do something like:

Code: Select all

SetFocus>Untitled - Notepad

GetWindowPos>Untitled - Notepad,x,y
GetWindowSize>Untitled - Notepad,width,height

Random>width,randX
Random>height,randY

Let>posX=randX+X
Let>posY=randY+Y

MouseMove>posX,posY
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

henryuscola
Newbie
Posts: 2
Joined: Mon Dec 15, 2014 8:28 am

Re: Help with script

Post by henryuscola » Mon Dec 15, 2014 12:31 pm

It wont because i want the mouse to keep moving within this specific window searching for an object to know what the object is and whether to click on it or not there must be some specific text on the top left corner of this window that should be associated with this object on the window

so the question is how do i make the mouse move randomly within this window until it finds a certain text on the top left corner and then clicks

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts