1905russell Posted July 21, 2006 Share Posted July 21, 2006 (edited) Proof of concept?This does not return as requested Origin 0,0 (which is the physical location) but 8,54 (client area Origin)?Like I said - Adjust for my function Func _MouseWCOutAdjustment() and youve got it.Just added the adjustment function to your beautiful work and it now shows 4,4 which is a fixed constant that should be included in the function if you are interested.It represents that tiny little gap between the rounded window edge and the screen at top left. Edited July 21, 2006 by 1905russell Link to comment Share on other sites More sharing options...
1905russell Posted July 23, 2006 Share Posted July 23, 2006 (edited) Your ending coords are also off. Anyway try this (thanks for the format, your work makes great examples). This will accurately give you the screen coods nomatter where the control sits. I guess you don't need a separate function when adjusting the coords. Here is the code. Local $Window = 'Untitled - Notepad' If Not WinExists($Window) Then Run('Notepad.exe') WinWaitActive($Window) ElseIf WinExists($Window) And Not WinActive($Window) Then WinActivate($Window) EndIf Global $aArrayControlScreenPos = _ControlGetScreenPos($Window, '', '', '') MsgBox(64, 'Info', 'X - Screen Start = ' & $aArrayControlScreenPos[1] & @CR & _ 'Y - Screen Start = ' & $aArrayControlScreenPos[2] & @CR & _ 'X Bottom Right Ending = ' & $aArrayControlScreenPos[3] & @CR & _ 'Y Bottom Right Ending = ' & $aArrayControlScreenPos[4]) Func _ControlGetScreenPos($hWnd, $shWndText, $sCIDText, $hWndCID) If IsString($hWnd) Then $hWnd = WinGetHandle($hWnd, $shWndText) If Not IsHWnd($hWndCID) Then $hWndCID = ControlGetHandle($hWnd, $sCIDText, $hWndCID) If Not WinActive($hWnd) Then Return SetError(1, 0, 0) Local $aWinPos = WinGetPos($hWnd), $aWinCSize = WinGetClientSize($hWnd) Local $aCtrlPos = ControlGetPos($hWnd, $sCIDText, $hWndCID) Local $iTinyWCorner = 4;tiny small space square on rounded top left If Not IsArray($aWinPos) Or Not IsArray($aWinCSize) Or Not IsArray($aCtrlPos) Then Return SetError(2, 0, 0) Return StringSplit(($aWinPos[0] + $aWinCSize[0] - ($aCtrlPos[2] + $aCtrlPos[0] - $iTinyWCorner)) & ',' & _ ($aWinPos[1] + $aWinCSize[1] - ($aCtrlPos[3] + $aCtrlPos[1] - $iTinyWCorner)) & ',' & _ ($aWinPos[0] + $aCtrlPos[2]) & ',' & _ ($aWinPos[1] + $aCtrlPos[3]), ',') EndFunc Edited July 23, 2006 by 1905russell Link to comment Share on other sites More sharing options...
dabus Posted January 9, 2007 Share Posted January 9, 2007 I just stumbled over this thread when searching for a "control under mouse" function. Larry's post from page 1 seems to do what I need. Didn't test the other stuff since Smoke_N mentioned that it's the one that's close to au3info. Big thank you. Now I can try to build a control-based recorder... if I just got enough time to do it. Link to comment Share on other sites More sharing options...
SadBunny Posted July 12, 2007 Share Posted July 12, 2007 WOW! Smoke's Revamped Code in the first couple of posts is exactly what I was looking for in my particular situation here. Thanks for feeding me the exact search term I needed... I am so jealous of your memory capacity And uhm, Smoke? This'll probably neither be the first nor the last time you hear this, but: You Rule! Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Bowmore Posted December 11, 2007 Share Posted December 11, 2007 OK? Then replace ToolTip() with MsgBox()? Edit: I'm truly confused because if you know how to use HotKeySet() why not just make a function that calls this one?HotKeySet('{HOME}', '_GETVALUE') While 1 Sleep(10000) WEnd Func _GETVALUE() MsgBox(64, 'Info:', _CtrlGetClassNN_ByPos()) EndFunc Func _CtrlGetClassNN_ByPos() Local $hWin = WinGetHandle(''), $sCreateArray = '', $sClassList = WinGetClassList($hWin) Local $sSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $sReturn = '' $OptMCM = Opt('MouseCoordMode', 2) Local $aMPos = MouseGetPos() Opt('MouseCoordMode', $OptMCM) For $iCount = UBound($sSplitClass) - 1 To 1 Step - 1 Local $nCount = 0 While 1 $nCount += 1 Local $aCPos = ControlGetPos($hWin, '', $sSplitClass[$iCount] & $nCount) If @error Then ExitLoop If $aMPos[0] >= $aCPos[0] And $aMPos[0] <= ($aCPos[0] + $aCPos[2]) _ And $aMPos[1] >= $aCPos[1] And $aMPos[1] <= ($aCPos[1] + $aCPos[3]) Then If $sSplitClass[$iCount] <> '' Then Return $sSplitClass[$iCount] & $nCount EndIf WEnd Next Return $sReturn EndFuncoÝ÷ Ûú®¢×»-&©¢Z 뢺޲êëyËbaËaænëH~§vl¬zWâwvÚébi¹^ëa¡Ûhק¶'òÂÊ'¶º%Á«Êek'jÖ©j»bréZ®Zjب8^¶«v«·! ý +)àÂ+aºÇ¬i»¶í¡Ø¬¦V²²wè®fí«HçyÛhRwè®Û§j×¥ÉØ}êÞا²Ö§që(~Ø^rí®aj÷yéî±çm¡Ø¬¦V²v'ßz·§¶Ü©zÊwè®fÓêÞ²émËajÛax"ÀI#M½©nz+¢{-j{eÉÈZ§)ÚÁ¬ßÙ®¦åzÚ)çbrÔ¦:G±Êâ¦Ö¢÷¥¢u«- ØÂ¥uÚ-èènâuéíü¢ayË«éí'b²ZÉç¢{k¢Yâqérû^ìiz¸¦z{b¥Ûexb±Ê/z·¶Â¥²Ô¦¢G±Êâ¦Øz{b~'-rí®l¶¬jg°·"w貶)²Ø^Ë«yØ}êÞÔ¨#ozfy§ÞÁ§]بËh¶¬r¸©µ©ÝjÇÚ«ßÛÞmç§i¹^¶^µêæw¢¶z0jÊÊÞ¶êç²Ø^±©°HÓoj[jÀ.Üß¡8^v'²'^ËajØÆÛ%£(ºf²~)ݶ¢è½çZqË«iÌ®±çîú+¶,yØ~'.Øz{b'(ÚèÆ®¶sd÷D¶W6WBb33·´TäGÒb33²Âb33µôWDæ÷rb33²´TäB'WGFöà¤÷D¶W6WBb33·´ôÔWÒb33²Âb33µôtUEdÅTRb33²¥vÆR£·âFööÅFô7G&ÄvWD6Æ74äåô'÷2vävWEFFÆRb33²b33²¢6ÆVWS¥tVæ@ ¤gVæ2ôtUEdÅTR¢×6t&÷cBÂb33´æfó¢b33²Âô7G&ÄvWD6Æ74äåô'÷2vävWEFFÆRb33²b33²¤VæDgVæ0 ¤gVæ2ô7G&ÄvWD6Æ74äåô'÷2b33c·46Föâ våvBb33c·46FöâÂgV÷C²gV÷C² bæ÷Bvä7FfRb33c·46FöâÂgV÷C²gV÷C²FVâvä7FfFRb33c·46FöâÂgV÷C²gV÷C² våvD7FfRb33c·46FöâÂgV÷C²gV÷C²¢Æö6Âb33c¶vâÒvävWDæFÆRb33c·46Föâ Æö6Âb33c·47&VFT'&Òb33²b33° Æö6Âb33c·46Æ74Æ7BÒvävWD6Æ74Æ7Bb33c¶vâ¢Æö6Âb33c·57ÆD6Æ72Ò7G&æu7ÆB7G&æuG&Õ&vBb33c·46Æ74Æ7BÂÂÄb Æö6Âb33c·5&WGW&âÒb33²b33° Æö6Âb33c´6Æ76æâÒb33²b33° Æö6Âb33c´ÖårÒ Æö6Âb33c´ÖäÒ¢b33c´÷DÔ4ÒÒ÷Bb33´Ö÷W6T6ö÷&DÖöFRb33²Â"¢Æö6Âb33c¶Õ÷2ÒÖ÷W6TvWE÷2¢÷Bb33´Ö÷W6T6ö÷&DÖöFRb33²Âb33c´÷DÔ4Ò¢ f÷"b33c¶6÷VçBÒFòb33c·57ÆD6Æ75³Ð¢Æö6Âb33c¶ä6÷VçBÒ¢vÆR¢b33c¶ä6÷VçB³Ò b33c´6Æ76æâÒb33c·57ÆD6Æ75²b33c¶6÷VçEÒfײb33c¶ä6÷Vç@¢Æö6Âb33c¶5÷2Ò6öçG&öÄvWE÷2b33c¶vâÂb33²b33²Âb33c´6Æ76æâ¢bW'&÷"FVâWDÆö÷ bb33c¶Õ÷5³ÒfwC³Òb33c¶5÷5³ÒæBb33c¶Õ÷5³ÒfÇC³Òb33c¶5÷5³Ò²b33c¶5÷5³%Òð æBb33c¶Õ÷5³ÒfwC³Òb33c¶5÷5³ÒæBb33c¶Õ÷5³ÒfÇC³Òb33c¶5÷5³Ò²b33c¶5÷5³5ÒFVà ²6V6²bFR6öçG&öÂ26öæ6FVçB÷"ç6FR&Wf÷W6ÇæFVçFfVB6öçG&öÂÂ77VÖær ²FBvRvçBFR6ÖÆÆW7B6öçG&öÂFBFRÖ÷W6R6ö÷&G2&RvFâà bb33c·57ÆD6Æ75²b33c¶6÷VçEÒfÇC²fwC²b33²b33²æBb33c¶5÷5³%ÒfÇC³Òb33c´ÖåræBb33c¶5÷5³5ÒfÇC³Òb33c´ÖäFVà ²6V6²FBFR6öçG&öÂ2æ÷BFFVâVæFW&æVFæ÷FW"6öçG&öÂà b6öçG&öÄ6öÖÖæBb33c·46FöâÂgV÷C²gV÷C²Âb33c´6Æ76æâÂgV÷C´5f6&ÆRgV÷C²FVà ²6WBæWr6ÖÆÆW7B6¦RFVçFfV@ b33c´ÖårÒb33c¶5÷5³%Ò b33c´ÖäÒb33c¶5÷5³5Ò b33c·5&WGW&âÒb33c´6Æ76æà VæD` VæD` VæD`¢tVæ@¢æW@¢&WGW&âb33c·5&WGW&à¤VæDgVæ0 ¤gVæ2ôWDæ÷r¢WB¤VæDgVæ "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 12, 2007 Moderators Share Posted December 12, 2007 http://www.autoitscript.com/forum/index.ph...c=30717&hl= 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. Link to comment Share on other sites More sharing options...
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