Sign in to follow this  
Followers 0
Speedmaster

Two questions on coordinates and window focus ...

4 posts in this topic

Thanks in advance for the help already given!

I'm tinkering with the recording functionality (against the Windoze calculator) and am running into two things, likely related.

1. What is the best mechanism for making sure the window I want is always in focus? As I replay a script sometimes it works, sometimes my recorded keystrokes get sent to the Windows desktop. What function(s) should I use to set a window properly?

2. Does it make sense to have the mouse coordinates be relative to the application window in focus, instead of the entire Windows screen? If so, how do I make that happen?

I did see this at the top of one of the scripts I recorded:

Opt("MouseCoordMode",0)

3. Is it safe to assume that mouse drag options are best avoided?

Thanks again, guys!

Chrs


ChrisInterested in economics, watches, or pens? If so, check out my blog.

Share this post


Link to post
Share on other sites



If you can, use controlclick() instead of mouseclick()

With control click, the window can be hidden or minimized. You don't need to "use" the users mouse, just simulate the click without interference.

$Pid = Run("calc.exe")
WinWait("[Class:CalcFrame]", "")
ControlClick("[Class:CalcFrame]", "", "[CLASSNN:Button5]")
ControlClick("[Class:CalcFrame]", "", "[CLASSNN:Button11]")
ControlClick("[Class:CalcFrame]", "", "[CLASSNN:Button16]")

Share this post


Link to post
Share on other sites

Thanks, Dan. Were you able to somehow record those steps, or did you have to hand code them?

If you can, use controlclick() instead of mouseclick()

With control click, the window can be hidden or minimized. You don't need to "use" the users mouse, just simulate the click without interference.

$Pid = Run("calc.exe")
WinWait("[Class:CalcFrame]", "")
ControlClick("[Class:CalcFrame]", "", "[CLASSNN:Button5]")
ControlClick("[Class:CalcFrame]", "", "[CLASSNN:Button11]")
ControlClick("[Class:CalcFrame]", "", "[CLASSNN:Button16]")


ChrisInterested in economics, watches, or pens? If so, check out my blog.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I hand coded them. You could automate the process with the winapi functions though.

Take a look

Edited by danwilli

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0