Jump to content

multiple resolutions


Recommended Posts

Dear reader,

My question; I have three computers. One runs at 1920x1280, one at 1650x1080 and one at a small resolution

of 1280x1024.

Is there a way so the script will automaticly see what resolution im using and correct the MoveMouse values?

What I mean is for example:

MoveMouse(299, 125);

That works fine on my 1920x1280 resolution but when im at my 1280x1024 resolution it will click no where near

the point where it should due a whole different size (resolution) of the screen.

Anyway to fix this?

Best regards

Link to comment
Share on other sites

Oke, I checked out a lot and I have to say I am confused lol it is just to hard for me to fully understand it since it is in English.

Ill explain what I want to archieve.

I have game in which I need to click on certain items.

This game will run in (sometimes) windowed mode, but sometimes in fullscreen. That's why I need something that will check the

window with for example the name "my neat game".

Then it should check what resolution it has been set, and click on the coordinates given by me in the script.

Depending on the window size it should click on a different spot of course since we can run it 1024x768, 1680x150 and so on.

Perhaps, someone could make me a sample script so I can copy & paste it, edit it and play around with it so I might learn to

fully understand it? otherwise ill never make it I am afraid lol.

Best regards

P.S. what I also dont fully understand is the next example:

$coord = PixelSearch( 0, 0, 1024, 768, 0xA54659 )

Does this means it takes the first hit it finds on a 1024x768 screen?

Cause what I want is what I am showing in the picture... a small box in the center of my screen.

the gray border = outside of the monitor lol, picture is the background, the RED rectangulair is the area I would like to use.

Posted Image

My script currently is:

; info message
MsgBox(0, "Valkyr's ", "Thanks!")

; configuration questions
$count  = InputBox("Valkyr's", "How many kills would you like to make?")
$skill1 = InputBox("Valkyr's ", "Will you use skill slot (1) one? 1 for Yes, 2 for No")
$skill2 = InputBox("Valkyr's ", "Will you use skill slot (2) two? 1 for Yes, 2 for No")
$skill3 = InputBox("Valkyr's", "Will you use skill slot (3) three? 1 for Yes, 2 for No")

; get the desktop width and height
$width  = @DesktopWidth;
$height = @DesktopHeight;

; start the loop for the count the user has prompted
$i = 1
While $i <= $count

; find a Tigero Initiate
    $coord = PixelSearch( 0, 0, 1024, 768, 0xA54659 )

; if it has been found and no error was returned
    If Not @error Then

; point at the Tigero
    MouseMove($coord[0], $coord[1])

; select the Tigero
        MouseClick("left");

; use the skill in skill slot 1 with a 2 second delay
        if $skill1 >= 1 Then
            Sleep(2000);
            Send("{1 DOWN}");
        EndIf

; use the skill in skill slot 2 with a 3 second delay
        if $skill2 >= 1 Then
            Sleep(3000);
            Send("{2 DOWN}");
        EndIf

; use the skill in skill slot 3 with a 2 second delay
        if $skill3 >= 1 Then
            Sleep(2000);
            Send("{3 DOWN}");
        EndIf

; use the skill in skill slot 1 with a 2 second delay
        if $skill1 >= 1 Then
            Sleep(2000);
            Send("{1 DOWN}");
        EndIf

; use the skill in skill slot 2 with a 3 second delay
        if $skill2 <= 1 Then
            Sleep(2000);
            Send("{2 DOWN}");
        EndIf

; use the skill in skill slot 3 with a 2 second delay
        if $skill3 <= 1 Then
            Sleep(2000);
            Send("{3 DOWN}");
        EndIf

    EndIf

; close the loop
WEnd

; give a confirmation message
; script beeindigen
MsgBox(0, "Valkyr's ", "Let us know!")

; webpagina openen
ShellExecute("http://www.mysite.com/viewtopic.php?f=8&t=23")

; close the script
Exit
Edited by Valkyrie
Link to comment
Share on other sites

I need to know where the center point is of the following resolutions:

1920 x 1080 @ 2073600 pixels

1680 x 1050 @ 1764000 pixels

1280 x 1024 @ 1310720 pixels

1027 x 768 @ 786432 pixels

I would like to select a pixel from a bounding box in the center.

Can someone tell me what pixel rates I need?

$coord = PixelSearch( 0, 0, 1024, 768, 0xA54659 )
Link to comment
Share on other sites

  • Developers

I need to know where the center point is of the following resolutions:

1920 x 1080 @ 2073600 pixels

1680 x 1050 @ 1764000 pixels

1280 x 1024 @ 1310720 pixels

1027 x 768 @ 786432 pixels

I would like to select a pixel from a bounding box in the center.

Can someone tell me what pixel rates I need?

$coord = PixelSearch( 0, 0, 1024, 768, 0xA54659 )
@DesktopWidth/2 and @DesktopHeight/2 are the center coordinates.

That isn't to hard now is it?

Oh, and dont BS us about English being difficult. Using that as argument just means you a lazy.. toch?

So, start reading up on things yourself. :D

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

It's not a excuse lol, having a normal conversation shouldnt be difficult for me but when it comes to the programming english where you have to uhmmm... what ever lol.

It's harder for me to understand cause it is explained in a bit different way then a normal conversation. Dunno the right word for it lol lol.

Anyways ill try to find it and look it up. Thank's for the help :D

Link to comment
Share on other sites

  • Developers

It's not a excuse lol, having a normal conversation shouldnt be difficult for me but when it comes to the programming english where you have to uhmmm... what ever lol.

It's harder for me to understand cause it is explained in a bit different way then a normal conversation. Dunno the right word for it lol lol.

Anyways ill try to find it and look it up. Thank's for the help :D

Het is niet zo moeilijk als het lijkt en ik weet zeker dat je het kunt leren als je wilt.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

if $width = 1920 And $height = 1080 Then
     $coord = PixelSearch( 640, 220, 320, 320, 0xA54659 )
EndIf

Does this mean:

start at 640 pixels from the left and 220 from the top...

then select all untill 320 pixels width and 320 pixels height further?

Dutch:

Wat ik bedoel is op een resolutie van 1920 x 1080 wil ik het midden selecteren met

een bounding box van 320 x 320 pixels. Wat ik nu doe in bovenstaande code klopt dat?

Dus op een resolutie van 1920x1080 begint hij met selecteren 640 pixels van links en

220 pixels van bovenaf, en dan selecteerd hij 320 pixels weider alles... ?

Edited by Valkyrie
Link to comment
Share on other sites

if $width = 1920 And $height = 1080 Then
     $coord = PixelSearch( 640, 220, 320, 320, 0xA54659 )
EndIf

Does this mean:

start at 640 pixels from the left and 220 from the top...

then select all untill 320 pixels width and 320 pixels height further?

If you tested you would see that it's wrong :/

From the Help Files

PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )

Your code should be

if $width = 1920 And $height = 1080 Then
     $coord = PixelSearch( 640, 220, 640+320, 220+320, 0xA54659 )
EndIf

Calculate the +s.

Link to comment
Share on other sites

  • 2 weeks later...

I also have the same problem.

My script only works with 1280X1024 Resolution otherwise the mouseclick method is out of range.

My current solution is use a formula in computing the X and Y coords of the mouseclick func.

But, there are some cases (not tested yet) that this might not work.

What im planning to do is have multiple coords for multiple resolutions.

E.g:

Switch @DesktopHeight

case 600

;For 800 X 600, 1280 X 600,

case 768

;For 1024 X 768, 1280 X 768, 1280 X 768

case 720

;For 1280 X 720,

case 864

;For 1152 X 864

case 900

;For 1440 X 900, 1600 X 900

case 960

;For 1280 X 960

case 1024

;For 1280 X 1024

case 1050

;For 1400 X 1050, 1680 X 1050

Endswitch

Btw, im only having trouble with the height since i only have to divide the width by 2 to get the center.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...