Sign in to follow this  
Followers 0
TrickyDeath

AutoItSetOption("MouseCoordMode", 2)

3 posts in this topic

Hello everyone,

Looking for someone who can help me with "AutoItSetOption("MouseCoordMode", 2)" how to use it right, and who can explain this.

I have made a little function, cause somehow my main function wont work correctly.
When i made this i figured out why the main function gave back the wrong value...

Looks like if i insert "AutoItSetOption("MouseCoordMode", 2)" in the function, it mess up my whole coordinate structures...

Here is my function for coordinate and color check:

HotKeySet("{F5}", "Display_Info")

While 1
Sleep(100)
WEnd
Func Display_Info()
While 1
  Local $MousePos = MouseGetPos()
  Local $Curent_Color_OnMouse

  AutoItSetOption("MouseCoordMode", 2)
  Local $MousePos_OnWindow = MouseGetPos()
  ToolTip("Mouse Coord: " & $MousePos[0] & " X " & $MousePos[1] & " " & "Color on Coord: " & PixelGetColor($MousePos[0], $MousePos[1]) & @CRLF & "Stored Coord: " & FileReadLine("mousex.txt", 1) & " X " & FileReadLine("mousey.txt", 1) & " " & "Color on Coord: " & PixelGetColor(FileReadLine("mousex.txt", 1), FileReadLine("mousey.txt", 1)) & @CRLF & @CRLF & "Mouse Coord on Window: " & $MousePos_OnWindow[0] & " X " & $MousePos_OnWindow[1] & " " & "Color on Coord: " & PixelGetColor($MousePos_OnWindow[0], $MousePos_OnWindow[1]) & @CRLF & "Stored Coord on Window: " & FileReadLine("mousex.txt", 2) & " X " & FileReadLine("mousey.txt", 2) & "Color on Coord: " & PixelGetColor(FileReadLine("mousex.txt", 2), FileReadLine("mousey.txt", 2)), 0, 0)
WEnd
;mousex.txt and mousey.txt have 2 line, both are numbers (mouse coordinates). Does not matter what numbers are u useing, it is only for to check, it work or not. First line can be coord on windows screen, second line can be coord on active window.
EndFunc   ;==>Display_Info

As you can see, the windows and window coordinate are the same, since i have "AutoItSetOption("MouseCoordMode", 2)" in the function. How can i make that order only for $MousePos_OnWindow?
Shell i try to use window handle for $MousePos_OnWindow and window screen for $MousePos?

Ohh, before i post this i tried like this:

HotKeySet("{F5}", "Display_Info")
HotKeySet("{F6}", "Display_")
While 1
Sleep(100)
WEnd

Func Display_Info()
While 1
  Local $MousePos = MouseGetPos()
  Local $Curent_Color_OnMouse
  AutoItSetOption("MouseCoordMode", 2)
  Local $MousePos_OnWindow = MouseGetPos()
  AutoItSetOption("MouseCoordMode", 1)

  ToolTip("Mouse Coord: " & $MousePos[0] & " X " & $MousePos[1] & " " & "Color on Coord: " & PixelGetColor($MousePos[0], $MousePos[1]) & @CRLF & "Stored Coord: " & FileReadLine("mousex.txt", 1) & " X " & FileReadLine("mousey.txt", 1) & " " & "Color on Coord: " & PixelGetColor(FileReadLine("mousex.txt", 1), FileReadLine("mousey.txt", 1)) & @CRLF & @CRLF & "Mouse Coord on Window: " & $MousePos_OnWindow[0] & " X " & $MousePos_OnWindow[1] & " " & "Color on Coord: " & PixelGetColor($MousePos_OnWindow[0], $MousePos_OnWindow[1]) & @CRLF & "Stored Coord on Window: " & FileReadLine("mousex.txt", 2) & " X " & FileReadLine("mousey.txt", 2) & "Color on Coord: " & PixelGetColor(FileReadLine("mousex.txt", 2), FileReadLine("mousey.txt", 2)), 0, 0)
WEnd
EndFunc   ;==>Display_Info

Was just an idea, and seams like work fine now, but not realy understand why.
Is it because in the first example, once i called AutoItSetOption("MouseCoordMode", 2), it stucked cause it is in while loop?
So when the loop start again, it alredy have it ON, so it change the first coordinate to window coordinate? Or why is that?

Other question:
How i can make that tooltip line in script multiline? Hard to read, if the tooltip will be 999 mile long in editor. :/

Can anyone explain to me how to use:

* = you can put parameters there, but how does they work, how i have to use them? In help file did not found that much about that.

Func TestFunction(*)

EndFunc


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites



Oky, seams like i found out how it wok, but i am not sure on the mechanism...

Still have a question, maybe someone with enough experience can give me the simple answare.

PixelGetColor work only on a visible window?

It worked to me, if the window was not active, but visible on screen on top. If i use window handle for PixelGetColor, i still have a problem, if i get a message / system message / popup, or anything what it is cover the scanned region, it will not work anymore. Is it cause i made mistake, or it is work only like this? If the second part, then do not understand, why i can use window handle for it? Cause for keep the window active, i can use other order like this:

     WinActivate($WinH_Array[$x])
     WinWaitActive($WinH_Array[$x])
     SendKeepActive($WinH_Array[$x])


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

Share this post


Link to post
Share on other sites

Looks like problem Solved by myself...


Sry for my bad English, and double sry, but I am learning AutoIT language by myself. :)

[u]Tricky[/u]

You can't teach a man anything, you can only help him, find it within himself. (Galileo Galilei)

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