Hi Again!,
I have been playing around with Macro Scheduler again and trying out some new commands. What I want to do is creat a loop where it finds UIAutomation Name: Some text, then click an object thats further up left on the screen. Is this possible?.
Find or Wait for Object then Click other object
Moderators: Dorian (MJT support), JRL, Phil Pendlebury
Re: Find or Wait for Object then Click other object
Here is my attempt, its not working but hopefully it explains further what I'm trying to do.
This is how I used to do it:
Code: Select all
SetFocus>Web App - Mozilla Firefox
label>webapp
if
UIClick>{"Web App - Mozilla Firefox"},{"Search"}
endif
label>noresults
FindWindowWithText>No results found,0,strTitle
If>NumFound>0
UIClick>{"Web App - Mozilla Firefox"},{""}
goto>webapp
else
GetWindowHandle>Find Object Wizard,hWndParent
If>NumFound>0
FindObject>hWndParent,TTabPage,,1,hWnd,X1,Y1,X2,Y2,result
UIClick>{"Web App - Mozilla Firefox"},{"Buy Now"}
endif
endif
goto>noresults
Code: Select all
SetFocus>PS4 Remote Play
Label>Restart
FindImagePos>C:\Users\Documents\Tra.bmp,WINDOW:PS4 Remote Play,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
HoldKey>v,48,0 // Cross
HoldKey>a,50,0 // D-Pad Left
HoldKey>g,50,0 // Circle
HoldKey>t,48,0 // Triangle
Endif
label>restarttwo
FindImagePos>C:\Users\Documents\NoResults.bmp,WINDOW:PS4 Remote Play,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
HoldKey>v,48,0 // Cross
goto>Restart
else
Label>ResultStart
FindImagePos>C:\Users\Sam Wade\Documents\SearchResults0.bmp,WINDOW:PS4 Remote Play,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
goto>SearchResult
endif
endif
goto>restarttwo
Re: Find or Wait for Object then Click other object
Also is it possible to bind a keyboard key to an object?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Find or Wait for Object then Click other object
Can you explain what you mean?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Find or Wait for Object then Click other object
Hi Marcus,
What I mean is for example, In a webpage you have buttons like submit, preview, save draft etc. I'd like to assign a shortcut key to some of these, if I press say the "S" it will save draft, if I press "T" key it will submit. I hope that clarifies it better.
Re: Find or Wait for Object then Click other object
@Sam71,
If you use the Object wizard to identify the object (button) you'd like to click, the next tab in Object Wizard let's you choose what action to take. If everything goes well, you will be able to choose "Left click the object" Assuming that......
You then could use OnEvent to setup a "hotkey" that will cause the object(button) to be left clicked. You can use the forum to get a list of the VK codes. If for example, you wanted it to click the button when you press 'F2' the OnEvent wold look like this.....
OnEvent>Key_Down,VK113,0,TheSubroutine
(this is one off the top of my head that I know, use the code for the key you'd like to use.)
The Subroutine is where you have the code inserted for the "action to take" with the Object Wizard. So when you press 'F2" OnEvent calls the subroutine, and the code there will click the object(button).
Ofcourse, this all relies on the buttons being objects and that the object wizard is able to identify them.
Hope this helps,
PepsiHog
If you use the Object wizard to identify the object (button) you'd like to click, the next tab in Object Wizard let's you choose what action to take. If everything goes well, you will be able to choose "Left click the object" Assuming that......
You then could use OnEvent to setup a "hotkey" that will cause the object(button) to be left clicked. You can use the forum to get a list of the VK codes. If for example, you wanted it to click the button when you press 'F2' the OnEvent wold look like this.....
OnEvent>Key_Down,VK113,0,TheSubroutine
(this is one off the top of my head that I know, use the code for the key you'd like to use.)
The Subroutine is where you have the code inserted for the "action to take" with the Object Wizard. So when you press 'F2" OnEvent calls the subroutine, and the code there will click the object(button).
Ofcourse, this all relies on the buttons being objects and that the object wizard is able to identify them.
Hope this helps,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!