Jump to content
Sign in to follow this  
newbie01

Write script run on different screen

Recommended Posts

newbie01

I write my script on 4:3 screen, 17", screen resolution 1024x768. But when I run on 14" monitor and the 21", 16:9 screen, It dont run

Here's my code

Opt("MouseCoordMode", 0) 
Opt("PixelCoordMode", 0)

WinMove("Element Client","", -1, -1, 1026,743)


while 1

    if PixelSearch(470,600,513,636,0xFFE955) <> @error Then
        MouseClick("left",493,619)  ;--> Click (!)
        sleep(500)
        
        Select
        case PixelSearch(440,636,585,662,0xFFFFFF) <> @error 
            Do
                MouseClick("left",517,650)
                sleep(500)
                MouseClick("left",442,425)
                sleep(500)
            until PixelSearch(440,636,585,662,0xFFFFFF) = @error
        Case Else
            MouseClick("left",442,425)
            sleep(500)
        EndSelect
    EndIf
    
WEnd

Could any one help me!

Share this post


Link to post
Share on other sites
GodlessSinner

Look at, compare, replace.

WinMove("Element Client","", -1, -1, @DesktopWidth,@DesktopHeight)

_____________________________________________________________________________

Share this post


Link to post
Share on other sites
newbie01

Could U say it clearly? I think if running on 16:9 screen (1680x1050) so the coordinates in Pixelsearch() has been changed and It dont run correctly

Share this post


Link to post
Share on other sites
oMBRa

You can solve this problem with some basic math,

for example on your 1680x1050 screen the pixel with 474 as the X coordinate is at 286 on a 1024x768

here is how to do it:

1680:470 = 1024:x

x = 470*1024/1680, x is the value you need

Share this post


Link to post
Share on other sites
newbie01

I use Opt(), It defend on Client windows, not screen but why It dont run :D:D

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.