Sign in to follow this  
Followers 0
wodzuu

Control ID under mouse cursor

46 posts in this topic

Hello,

How can I get the ClassNameNN of element placed under my mouse cursor ? I need something like in Au3info tool - you just place cursor over element and you get it's Control ID or ClassNameNN

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hello,

How can I get the ClassNameNN of element placed under my mouse cursor ? I need something like in Au3info tool - you just place cursor over element and you get it's Control ID or ClassNameNN

The Command

GuiGetCursorInfo

will return an array with attribute [4] returning the controlid. of your gui

never tried it on a 3rd party Gui.

HardCopy

Edited by HardCopy

Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

The Command

GuiGetCursorInfo

will return an array with attribute [4] returning the controlid.

HardCopy

That's only for a GUI made with GUICreate() though :D

[center]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.[/center]

Share this post


Link to post
Share on other sites

That's only for a GUI made with GUICreate() though :D

Yes figured it might, hence i edited my initial reply.

haven't u got some pool to shoot!


Contributions: UDF _DateYearFirstChildren are like Farts, you can just about stand your own.Why am I not a Vegetarian?...Well...my ancestors didn't fight & evolve to the Top of the food chain for me to survive on Salad

Share this post


Link to post
Share on other sites

Yes figured it might, hence i edited my initial reply.

haven't u got some pool to shoot!

LOL, tomorrow night.

Here's an effort, although, I'm conflicting with AutoInfo for some reason... :D I've not had any sleep, so I'll let everyone tear it apart and maybe come up with something useful...

HotKeySet('{END}', '_ExitNow') ;END Button
While 1
    ToolTip(_WinGetClassNN_ByPos(WinGetTitle('')))
    Sleep(10)
WEnd

Func _WinGetClassNN_ByPos($hWin, $sWinText = '')
    If StringInStr(WinGetTitle($hWin), $hWin) Then
        $hWin = WinGetHandle($hWin)
    ElseIf Not IsHWnd($hWin) Then
        $hWin = HWnd($hWin)
    EndIf
    
    ;Get all class names of window
    Local $sCreateArray = ''
    $sClassList = WinGetClassList($hWin, $sWinText)
    $sSplitClass = StringSplit(StringTrimRight($sClassList, - 2), @CRLF)
    
    For $iCount = 1 To UBound($sSplitClass) - 1
        If Not StringInStr($sCreateArray, $sSplitClass[$iCount]) Then
            $sCreateArray &= $sSplitClass[$iCount] & @LF
        EndIf
    Next
    
    ;Seperate different ClassNameNN's
    $sCreateArray = StringSplit(StringTrimRight($sCreateArray, 2), @LF)
    ;Create a 0 base 1 dimensional array
    Local $aAddCount[UBound($sCreateArray)]
    For $iAdd = 1 To UBound($aAddCount) - 1
        $aAddCount[$iAdd] = 0
    Next
    
    For $iCount = 1 To UBound($sSplitClass) - 1
        For $xCount = 1 To UBound($sCreateArray) - 1
            If $sCreateArray[$xCount] = $sSplitClass[$iCount] Then
                $aAddCount[$xCount] += 1
                $sSplitClass[$iCount] &= $aAddCount[$xCount]
                ExitLoop
            EndIf
        Next
    Next
    
    $OptMCM = Opt('MouseCoordMode', 2)
    For $iCount = 1 To UBound($sSplitClass) - 1
        Local $aCPos = ControlGetPos($hWin, '', $sSplitClass[$iCount])
        Local $aMPos = MouseGetPos()
        If Not IsArray($aCPos) Or Not IsArray($aMPos) Then Return 0
        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 ControlGetFocus($hWin) <> $sSplitClass[$iCount] Then ControlFocus($hWin, '', $sSplitClass[$iCount])
            Opt('MouseCoordMode', $OptMCM)
            Return $sSplitClass[$iCount]
        EndIf
    Next
    Opt('MouseCoordMode', $OptMCM)
    Return 0
EndFunc

Func _ExitNow()
    Exit 0
EndFunc

[center]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.[/center]

Share this post


Link to post
Share on other sites

AU3Info returns the last control found at the mouse coords... in case that helps...

LAr.

Yes Larry, thanks, I am way to tired to debug it (God only knows if I would have bothered to try :D ), I know there is still an issue somewhere
HotKeySet('{END}', '_ExitNow') ;END Button
While 1
    ToolTip(_WinGetClassNN_ByPos(WinGetTitle('')))
    Sleep(10)
WEnd

Func _WinGetClassNN_ByPos($hWin, $sWinText = '')
    If StringInStr(WinGetTitle($hWin), $hWin) Then
        $hWin = WinGetHandle($hWin)
    ElseIf Not IsHWnd($hWin) Then
        $hWin = HWnd($hWin)
    EndIf
    
    ;Get all class names of window
    Local $sCreateArray = ''
    $sClassList = WinGetClassList($hWin, $sWinText)
    $sSplitClass = StringSplit(StringTrimRight($sClassList, - 2), @CRLF)
    
    For $iCount = 1 To UBound($sSplitClass) - 1
        If Not StringInStr($sCreateArray, $sSplitClass[$iCount]) Then
            $sCreateArray &= $sSplitClass[$iCount] & @LF
        EndIf
    Next
    
    ;Seperate different ClassNameNN's
    $sCreateArray = StringSplit(StringTrimRight($sCreateArray, 2), @LF)
    ;Create a 0 base 1 dimensional array
    Local $aAddCount[UBound($sCreateArray)]
    For $iAdd = 1 To UBound($aAddCount) - 1
        $aAddCount[$iAdd] = 0
    Next
    
    For $iCount = 1 To UBound($sSplitClass) - 1
        For $xCount = 1 To UBound($sCreateArray) - 1
            If $sCreateArray[$xCount] = $sSplitClass[$iCount] Then
                $aAddCount[$xCount] += 1
                $sSplitClass[$iCount] &= $aAddCount[$xCount]
                ExitLoop
            EndIf
        Next
    Next
    
    $OptMCM = Opt('MouseCoordMode', 2)
    For $iCount = UBound($sCreateArray) - 1 To 1 Step - 1
        Local $aCPos = ControlGetPos($hWin, '', $sSplitClass[$iCount])
        Local $aMPos = MouseGetPos()
        If Not IsArray($aCPos) Or Not IsArray($aMPos) Then Return 0
        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
            Opt('MouseCoordMode', $OptMCM)
            If $sSplitClass[$iCount] <> '' Then Return $sSplitClass[$iCount]
        EndIf
    Next
    Opt('MouseCoordMode', $OptMCM)
    Return 0
EndFunc

Func _ExitNow()
    Exit 0
EndFunc
But this follows your example.

[center]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.[/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Nice one!! I was thinking of maybe WinGetPos() there for a while too... - Mines faster :D

Edit:

Of course, I don't do much error checking do I :D

Edit2:

Big difference between yours and mine...

Yours works just like AutoInfo / Mine doesn't :wacko:

I think my coords are off. Anyway, off to bed!

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Ok, after getting some sleep, I realize that G** Da** I over complicate stuff... I re-vamped it and now it's 3 x's faster than my other one and more accurate for a change:

HotKeySet('{END}', '_ExitNow') ;END Button

While 1
    ToolTip(_CtrlGetClassNN_ByPos())
    Sleep(20)
WEnd

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
EndFunc

Func _ExitNow()
    Exit 0
EndFunc
Edit:

Pasted wrong one :D

Edit2:

Still not anywhere near as good as Au3Info :wacko:

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Ok, after getting some sleep, I realize that G** Da** I over complicate stuff... I re-vamped it and now it's 3 x's faster than my other one and more accurate for a change:

HotKeySet('{END}', '_ExitNow') ;END Button

While 1
    ToolTip(_CtrlGetClassNN_ByPos())
    Sleep(20)
WEnd

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
EndFunc

Func _ExitNow()
    Exit 0
EndFunc
Edit:

Pasted wrong one :D

Edit2:

Still not anywhere near as good as Au3Info :D

Thanks! That's what i was looking for :wacko:

Share this post


Link to post
Share on other sites

Thanks! That's what i was looking for :)

Maybe you can help what I am looking for.

I'm a medium novice programmer and an above average macroer. This is my first posting.

I tried your code and it works great. I figured I would pull it apart to do what I needed but got confused.

Q1- I need to press a key and return (say in a MsgBox) the ClassNameNN of the clicked control only.

Q2- When I use your code or use Auloit Window Info on a nonGUICreated window, I can see in both ClassNameNN's Edit1 and Edit2. Yet when I MsgBox WinGetClassList it lists all the classes including several Edits none of which are 1 or 2. How can I display these numbers.

Please help

Share this post


Link to post
Share on other sites

$sSplitClass[$iCount] & $nCount

$sSplitClass[$iCount] = The ClassNameNN without a number

$nCount = the number of the control, the 2 together give you the 1, 2, 3 etc..


[center]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.[/center]

Share this post


Link to post
Share on other sites

$sSplitClass[$iCount] & $nCount

$sSplitClass[$iCount] = The ClassNameNN without a number

$nCount = the number of the control, the 2 together give you the 1, 2, 3 etc..

I see but then why would all text fields in this particular control return Edit1 and all numeric fields Edit2.

You never answered Q1. Is it that easy?

Share this post


Link to post
Share on other sites

If you Used _Ispressed() or HotKeySet() and the UDF up above then obviously you can do that.

I have no idea what your talking about Edit1 / Edit2, I don't even know what application your talking about.


[center]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.[/center]

Share this post


Link to post
Share on other sites

If you Used _Ispressed() or HotKeySet() and the UDF up above then obviously you can do that.

I have no idea what your talking about Edit1 / Edit2, I don't even know what application your talking about.

I know how to HotKeySet. On HotKeySet I want to trigger your function to return the class without it running all the time under the mouse.

All QuickBooks journals and other input screens show numeric fields as Edit2 and text as Edit1. I want to click on either field and then HotKeySet to return the class as in your toolbar but in say a MsgBox.

Thanks for the help so far.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I know how to HotKeySet. On HotKeySet I want to trigger your function to return the class without it running all the time under the mouse.

All QuickBooks journals and other input screens show numeric fields as Edit2 and text as Edit1. I want to click on either field and then HotKeySet to return the class as in your toolbar but in say a MsgBox.

Thanks for the help so far.

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
EndFunc
Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

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
EndFunc
Perfet - thanks a million

It looks so obvious now that I see it.

Will work with it tomorrow and take it to the next level.

By the way $nCount += 1 gives a syntax error, so I changed it to $nCount = $nCount + 1

Thanks again

Share this post


Link to post
Share on other sites

Perfet - thanks a million

It looks so obvious now that I see it.

Will work with it tomorrow and take it to the next level.

By the way $nCount += 1 gives a syntax error, so I changed it to $nCount = $nCount + 1

Thanks again

+= is Beta, you should be using that anyway if you plan on using scripts on the forum, or you'll get plenty of syntax errors.

[center]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.[/center]

Share this post


Link to post
Share on other sites

+= is Beta, you should be using that anyway if you plan on using scripts on the forum, or you'll get plenty of syntax errors.

Thanks did it.

While on this topic -

So how do you GetControlID() as displayed under mouse on Autoit Window Info? NonGuiCreated.

I bet you know. What's the big secret anyway?

Thanks for everything.

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

Maybe like this:

HotKeySet('{HOME}', '_GETVALUE')

While 1
    Sleep(10000)
WEnd

Func _GETVALUE()
    MsgBox(64, 'Info1:', 'Both:' & @CRLF & _MouseGetCtrlInfo(2))
    Sleep(1000)
    MsgBox(64, 'Info2:', 'ControlID = ' & _MouseGetCtrlInfo(1))
    Sleep(1000)
    MsgBox(64, 'Info2:', 'ClassNameNN = ' & _MouseGetCtrlInfo())
EndFunc

Func _MouseGetCtrlInfo($iReturnType = 0); 0 = return ClassNameNN / 1 = ControlID / 2 = Both (will need to parse to seperate
    Local $hWin = WinGetHandle(''), $hCtrlWnd = '', $sClassList = WinGetClassList($hWin)
    Local $sSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn = ''
   
    $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] <> '' And Not $iReturnType Then 
                    Return $sSplitClass[$iCount] & $nCount
                ElseIf $sSplitClass[$iCount] <> '' And $iReturnType = 2 Then 
                    $hCtrlWnd = ControlGetHandle($hWin, '', $sSplitClass[$iCount] & $nCount)
                    ControlFocus($hWin, '', $hCtrlWnd)
                    $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd)
                    If @error = 0 And $aReturn[0] <> '' Then _
                        Return 'ControlID: ' & $aReturn[0] & @CRLF & 'ClassNameNN: ' & $sSplitClass[$iCount] & $nCount
                    Return 'ClassNameNN: ' & $sSplitClass[$iCount] & $nCount
                ElseIf $sSplitClass[$iCount] <> '' And $iReturnType Then 
                    $hCtrlWnd = ControlGetHandle($hWin, '', $sSplitClass[$iCount] & $nCount)
                    ControlFocus($hWin, '', $hCtrlWnd)
                    $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd)
                    If @error = 0 And $aReturn[0] <> '' Then Return $aReturn[0]
                    Return ''
                EndIf
            EndIf
        WEnd
    Next
    Return ''
EndFunc
Didn't really test it, but I think it should work.

Edit:

AutoIt Code tags screwed up :D

Edit2:

Made it all one function.

Edit3:

Added an option to recieve both, if there is no ControlID it will return a Blank screen, if getting both, it will only return the ClassNameNN if the ControlID doesn't exist.

Edited by SmOke_N

[center]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.[/center]

Share this post


Link to post
Share on other sites

Maybe like this:

HotKeySet('{HOME}', '_GETVALUE')

While 1
    Sleep(10000)
WEnd

Func _GETVALUE()
    MsgBox(64, 'Info1:', 'Both:' & @CRLF & _MouseGetCtrlInfo(2))
    Sleep(1000)
    MsgBox(64, 'Info2:', 'ControlID = ' & _MouseGetCtrlInfo(1))
    Sleep(1000)
    MsgBox(64, 'Info2:', 'ClassNameNN = ' & _MouseGetCtrlInfo())
EndFunc

Func _MouseGetCtrlInfo($iReturnType = 0); 0 = return ClassNameNN / 1 = ControlID / 2 = Both (will need to parse to seperate
    Local $hWin = WinGetHandle(''), $hCtrlWnd = '', $sClassList = WinGetClassList($hWin)
    Local $sSplitClass = StringSplit(StringTrimRight($sClassList, 1), @LF), $aReturn = ''
   
    $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] <> '' And Not $iReturnType Then 
                    Return $sSplitClass[$iCount] & $nCount
                ElseIf $sSplitClass[$iCount] <> '' And $iReturnType = 2 Then 
                    $hCtrlWnd = ControlGetHandle($hWin, '', $sSplitClass[$iCount] & $nCount)
                    ControlFocus($hWin, '', $hCtrlWnd)
                    $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd)
                    If @error = 0 And $aReturn[0] <> '' Then _
                        Return 'ControlID: ' & $aReturn[0] & @CRLF & 'ClassNameNN: ' & $sSplitClass[$iCount] & $nCount
                    Return 'ClassNameNN: ' & $sSplitClass[$iCount] & $nCount
                ElseIf $sSplitClass[$iCount] <> '' And $iReturnType Then 
                    $hCtrlWnd = ControlGetHandle($hWin, '', $sSplitClass[$iCount] & $nCount)
                    ControlFocus($hWin, '', $hCtrlWnd)
                    $aReturn = DllCall('User32.dll', 'int', 'GetDlgCtrlID', 'hwnd', $hCtrlWnd)
                    If @error = 0 And $aReturn[0] <> '' Then Return $aReturn[0]
                    Return ''
                EndIf
            EndIf
        WEnd
    Next
    Return ''
EndFunc
Didn't really test it, but I think it should work.

Edit:

AutoIt Code tags screwed up :D

Edit2:

Made it all one function.

Edit3:

Added an option to recieve both, if there is no ControlID it will return a Blank screen, if getting both, it will only return the ClassNameNN if the ControlID doesn't exist.

Incredible - I did not expect you to do this. I had read on other forums that ClassNameNN and ControlID were usually interchangeable - I was going to test this. Thank you. Thank you. Thank you. I won't get a chance till Monday when I will look at it to fully understand the logic and then continue with the rest of the puzzle concerning a problem that I am determined to resolve. I really appreciate your help and am reluctant to ask anything else at this point for fear of seeming to take advantage of an expert BUT I assume Visible and Hidden Window Text under mouse is going to be easy with Win/ControlGetText and WinDetectHiddenText? Now thanks to you I can locate exactly where I am and these two remaining text elements now hold the key to my macro's success. I'm exited and can't wait till Monday. Enjoy the weekend (today its going up to +40C with humidex in Toronto)

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