Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Cursor position


  • Please log in to reply
15 replies to this topic

#1 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 24 May 2004 - 06:18 PM

Hi, (sorry for my bad english, just in case)
i dont know whats the problem when i open my desired windows to get the X,Y poisition for macroing, i move my cursor on the desired position, then write the X,Y coord, when i move my mouse and put the cursor on the same place again i have a big difference of 100*pixel .. (using AutoIt Window Spy) never the same result i tried to start each time from coord 0, 0 then move back to the desired position .. always the same problem and btw i dont have any cursor acceleration
anyone know?







#2 emmanuel

emmanuel

    No one ever accused me of being normal.

  • Active Members
  • PipPipPipPipPipPip
  • 1,128 posts

Posted 24 May 2004 - 06:57 PM

probably has to do with your using either the coords relative to the window versus relative to the desktop size, something like that... rtfm, look at the autoit options, you can set it to use one or the other.
"I'm not even supposed to be here today!" -Dante (Hicks)

#3 pekster

pekster

    Newfound chai tea convert

  • Active Members
  • PipPipPipPipPipPip
  • 902 posts

Posted 24 May 2004 - 07:00 PM

There are a couple things to be careful of when using pixel coordinates. Mainly, you should pay attention to what MouseCoordMode you are in. You can either use absolute screen coordinates (the default) or coordinates relative to the active window. Each one is more appropriate in various curcumstantes. For example, if you are using absolute coordinates and get your mouse position through the Spy window, unless the window is in the exact same position next time it is opened, it will be in a different location. This will cause your previously working script to break.
"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

#4 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 24 May 2004 - 07:01 PM

no, because my window cursor and desktop cursor are the same... i can start from 0,0 then going to my hotspot and just for fun going back to 0,0 (normally top-left corner) i can get coord 0,0 in center of my window ?!?! how im suppose now to make a working macro with mouseclick.

#5 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 24 May 2004 - 07:06 PM

im currently using .. example: "MouseClick ("Left", 466, 42, 2)"
but is not the problem the problem is how to get an "absolute window coordinate"
can you explain more what you are talking about Pekster?

#6 Josbe

Josbe

    Infrequent ghost ☺

  • Active Members
  • PipPipPipPipPipPip
  • 1,585 posts

Posted 24 May 2004 - 07:08 PM

Check in the help file, about this options:
Opt( "PixelCoordMode", ... Opt( "CaretCoordMode", ... Opt( "MouseCoordMode", ...


Relative or absolute.

#7 pekster

pekster

    Newfound chai tea convert

  • Active Members
  • PipPipPipPipPipPip
  • 902 posts

Posted 24 May 2004 - 07:15 PM

Absolute coordinates are full screen coordinates whereas window relative coordinates are specific to the active window. In the included image below, the corner where the red arrow points is the absolute coordinates 0, 0 and the yellow arrow points to the corner of the window that is also coordinates 0, 0. The differance is that one is using the absolute coordinate option, and the other is set to relative. Please see the function Opt() in the manual for information on this. Also, a larger sample of the image is avaiable here. (Sorry, the larger picture file was killing my UT2K4 game. You'll just have to live with the smaller one :D )



Edited to correct a small typo, and again to remove larger picture

Edited by pekster, 24 May 2004 - 08:05 PM.

"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.

#8 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 24 May 2004 - 07:16 PM

ok thanks for the info but the main problem still unresolved... how do i get THE coordinate of my hotspot.

EDIT: its impossible for me to get the right coord cause when i move my mouse around and trying to get the coord again it always change sometime i can have 330,30 .. or 576,60 etc.. etc..

Edited by Zykl02, 24 May 2004 - 07:20 PM.


#9 emmanuel

emmanuel

    No one ever accused me of being normal.

  • Active Members
  • PipPipPipPipPipPip
  • 1,128 posts

Posted 24 May 2004 - 07:23 PM

ok thanks for the info but the main problem still unresolved... how do i get THE coordinate of my hotspot.

well, what's your hotspot? I button on a dialog, a picture on a webpage? there's numerous ways to get a location and then have a mouse click on it...
here's a little snipet that looks for a specific color then moves the mouse to that coord. I wrote it in a do loop to play curveball.swf automatically (it sucks, but it does move the mouse to that color)
  $moveto = PixelSearch(113, 145, 689, 540, 0xA0FFB2 , 10 , 2)    If Not @error Then    MouseMove( $moveto[0], $moveto[1] ,0 )    EndIf


in this case I just went with absolute coords and avoided the issue of windows size and location by resizing the IE window to 800x600 at the start of the script.
"I'm not even supposed to be here today!" -Dante (Hicks)

#10 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 24 May 2004 - 07:54 PM

ok thanks i will try to make my macro using pixel color its a little more tricky but it should work too

#11 emmanuel

emmanuel

    No one ever accused me of being normal.

  • Active Members
  • PipPipPipPipPipPip
  • 1,128 posts

Posted 24 May 2004 - 10:09 PM

ok thanks i will try to make my macro using pixel color its a little more tricky but it should work too

well, really, what're you trying to click? there's probably a better and less iffy way than pixel searching... can you do whatever you're trying to do by just using the keyboard? that's the best way to get autoit to work right everytime... well, second best, the best is really to us controls...
"I'm not even supposed to be here today!" -Dante (Hicks)

#12 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 24 May 2004 - 10:13 PM

no theres only mouse input for what i want to do :D

#13 emmanuel

emmanuel

    No one ever accused me of being normal.

  • Active Members
  • PipPipPipPipPipPip
  • 1,128 posts

Posted 24 May 2004 - 10:19 PM

what is it you're trying to click?

Please elaborate to help us help you...
Some helpful information:
  • Your Operating System (or Systems if this is a cross platform issue)
  • Script snipit of the script that's not working (try to isolate just the part that's not working)
  • what you've already tried to make it work (snipits of that code doesn't hurt if you have it)
  • what version of autoit you're running
  • what you're trying to make the script do (someone may have already
  • figured it out, or it might be in the FAQ)
  • what you've already read in the FAQ or Help File that didn't work
  • And whatever else you think might be helpful in helping us help you...

"I'm not even supposed to be here today!" -Dante (Hicks)

#14 Zykl02

Zykl02

    Seeker

  • New Members
  • 7 posts

Posted 25 May 2004 - 12:00 AM

anyway guys this is not script or autooit the problem ,, is windows spy who cant get the real coordinate

#15 Valik

Valik

    Former developer.

  • Active Members
  • PipPipPipPipPipPip
  • 18,879 posts

Posted 25 May 2004 - 12:40 AM

I have yet to see the Window Spy produce the behavior you are describing. Are you absolutely positive you are reading it correctly? Can you give any more information other than "It don't work" to us, such as what window are you trying to view? The more you tell us, the more likely you are to get the problem solved.

#16 pekster

pekster

    Newfound chai tea convert

  • Active Members
  • PipPipPipPipPipPip
  • 902 posts

Posted 25 May 2004 - 01:43 AM

Are you sure you are reading the right values? I have used the SpyWindow since version 2 of AutoIt, and I have never seen it report invalid pixel coordinates on any OS from 98 to XP Pro. There is a sample of what you want to look for in a linked picture. As you can see, when I mouse over the "File" menu (let's say I wanted to click on it) the highlighted rectangle in red shows the absolute ("On Desktop") coordinates, and the relative ("In Window") coordinates. The absolute coordinates will never change for the same mouse position on the screen (unless you change resoutions.) Also, as long as the window stays the same size, the relative coordinates should always point to the "File" menu of this window provided it is the active window when using relative coordinates.
"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users