Jump to content
Sign in to follow this  
Blue_Drache

General Question

Recommended Posts

Blue_Drache

Ok, I need to click in position x, y on a window that may not be the exact size as mine.... am I correct in assuming that I could use the position I need to click in as a ratio to the entire size of the window?

For example::

$size = WinGetPos($b)
$x = Round($size[2] * .22527)
$y = Round($size[3] * .39333333333333)

On my screen it clicks in position x=165, y=177

Centered exactly where I need it.

On someone else's screen, would it click in the same general area based on the ratio of the size with a margian of error of no more than 5 pixels in any direction?


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
this-is-me

Try ControlClick instead.


Who else would I be?

Share this post


Link to post
Share on other sites
Blue_Drache

It's not a button, but a "hot spot" region on the screen of an AS400 emulator. No buttons to click and AutoIt can't read it unless I stuff it into the clipboard.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
Nova

Why dont you re-size you desktop a few times run the script and see if it always works ?

Share this post


Link to post
Share on other sites
Blue_Drache

These emulators have pretty good macro languages... especially Attachmate. It may be worth looking into. Otherwise, there is PixelSearch / PixelGetColor and pixel mapping.

Lar.

<{POST_SNAPBACK}>

Well, that would work....if the users didn't customize the look of the interface. Some have blue backgrounds with red text and a window size of 400x700, green background with black text and a window size of 500x600, you get the idea.....

I was trying for a consistant idea that would get it to the same area.

And the macro language *IS* powerful, but can't transfer information between the windows (We run 5 separate AS400 windows). I'm using AutoIt as an additional layer on top of the macro language and helper program, CMMouse, to fill in the gaps. I could use VBS to write code that these emulators would run natively, but I haven't a clue on how to code in VBS...it's rather intimidating.

Why dont you re-size you desktop a few times run the script and see if it always works ?

*dopeslap*

Talk about an id-10t error....Ok, I'm dumb. Working too hard I guess. Yeah, I should test it by resizing myself. Thanks.

<sheesh> :D:idiot:

EDIT: The ratio works for the window sizes I tested. It clicks the region within the margians specified. Thanks Nova....simple solution that required a complex question.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites
Britbadboy

EDIT: The ratio works for the window sizes I tested.  It clicks the region within the margians specified.  Thanks Nova....simple solution that required a complex question.

<{POST_SNAPBACK}>

Hi there,

with me it still goes above the mouse button. Please have a look at the code:

Global $b

$size = WinGetPos($:lmao:

$x = Round($size[2] * (56/1024))

$y = Round($size[3] * (409/768))

MouseMove ($x,$y) ; points to the right button.

MouseClick("") ; clicks mouse.

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  

×