JayJay Posted July 9, 2006 Posted July 9, 2006 (I have MouseCoordMode and PixelCoordMode set to relative)I'm checking something at position $X,$Y and want a tooltip to appear there to show me some info.The PixelGetColor($X,$Y) is relative to the window I'm checking, but ToolTip("text goes here",$x,$y) is relative to the desktop (absolute coordinates)I've looked at the other Opt(..) but can't find a setting for ToolTip coordinates.Here is short script to show what I mean:(I've added the mousemove to indicate what pixel is being checked, but I want the tooltip to appear there without moving the mouse)Opt("MouseCoordMode", 0) ; 1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 0) ; 1=absolute, 0=relative, 2=client #include "GUIConstants.au3" HotKeySet("{ESC}", "Terminate") ; ESC to Terminate GuiCreate("Test",200,200,200,200) GUISetState() $x=Random(1,200,1) ; random postion $y=Random(1,200,1) MouseMove($x,$y) ; move mouse, relative to window Tooltip("This is a tooltip",$x,$y) ; tooltip is relative to desktop While 1 Sleep(500) WEnd Func Terminate() Exit EndFunc
Moderators SmOke_N Posted July 9, 2006 Moderators Posted July 9, 2006 Opt("MouseCoordMode", 2) ; 1=absolute, 0=relative, 2=client Opt("PixelCoordMode", 2) ; 1=absolute, 0=relative, 2=client #include "GUIConstants.au3" HotKeySet("{ESC}", "Terminate") ; ESC to Terminate GuiCreate("Test",200,200,200,200) GUISetState() $x=Random(1,200,1) ; random postion $y=Random(1,200,1) MouseMove($x,$y) ; move mouse, relative to window $OptMCM = Opt('MouseCoordMode', 1) $Mpos = MouseGetPos() Tooltip("This is a tooltip",$Mpos[0],$Mpos[1]) ; tooltip is relative to desktop Opt('MouseCoordMode', $OptMCM) While 1 Sleep(500) WEnd Func Terminate() Exit EndFuncIs this what you mean? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Moderators SmOke_N Posted July 10, 2006 Moderators Posted July 10, 2006 Ooops! I was reviewing my posts, and I noticed you wanted to do this without having use MouseMove(), Here is what I came up with:#include "GUIConstants.au3" HotKeySet("{ESC}", "Terminate") ; ESC to Terminate $MainGUI = GuiCreate("Test", 200, 200, 800, 200) GUISetState() $x = Random(1, 200, 1) ; random postion $y = Random(1, 200, 1) _ToolTipClient($MainGUI, 'This is a tooltip', $x, $y) While 1 Sleep(500) WEnd Func Terminate() Exit EndFunc Func _ToolTipClient($hwnd_Client, $s_Text, $iXPos = 0, $iYpos = 0, $i_Title = '', $i_Icon = 0, $i_Options = 0) If Not IsHWnd($hwnd_Client) Then $hwnd_Client = WinGetHandle($hwnd_Client) Local $iWCSize = WinGetClientSize($hwnd_Client), $iWPos = WinGetPos($hwnd_Client) If Not IsArray($iWPos) Or Not IsArray($iWCSize) Then Return 0 Local $iMoveXPos = (($iWPos[2] - $iWCSize[0]) + ($iWPos[0] + $iXPos)), $iMoveYPos = (($iWPos[3] - $iWCSize[1]) + ($iWPos[1] + $iYpos)) ToolTip($s_Text, $iMoveXPos, $iMoveYPos, $i_Title, $i_Icon, $i_Options) Return 1 EndFuncSeemed to work. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now