Jump to content

Controlundermouse


Recommended Posts

Is there a way to get the controlID or ClassNameNN of the control that is currently under the mouse pointer? I couldnt figure out how to do it....

This would have to be done without knowing the name of the active window. Maybe do something like this:

Func _GetControlUnderMouse ()
    $arrMousePos = MouseGetPos ()
   ; use the $arrMousePos to get the Control Under Mouse
   ; kinda like how au3Info.exe does it
    Return $strControlName
EndFunc;_GetControlUnderMouse ()

I couldn't figure out how to do this...

Thanks,

Todd

Link to comment
Share on other sites

Is there a way to get the controlID or ClassNameNN of the control that is currently under the mouse pointer? I couldnt figure out how to do it....

This would have to be done without knowing the name of the active window. Maybe do something like this:

Func _GetControlUnderMouse ()
    $arrMousePos = MouseGetPos ()
  ; use the $arrMousePos to get the Control Under Mouse
  ; kinda like how au3Info.exe does it
    Return $strControlName
EndFunc;_GetControlUnderMouse ()

I couldn't figure out how to do this...

Thanks,

Todd

use the autoit window info tool in the autoit program group on your start menu
Link to comment
Share on other sites

use the autoit window info tool in the autoit program group on your start menu

I actually want to do this from inside the script itself... I know that the window spy exists, but I dont want that running while my script is running...

Link to comment
Share on other sites

and you can't use the text in the control?

No I Cant. Basically what I'm trying to do is "Count" how many icons are in the Windows Task Tray. I want to look at each one, and make sure certain ones are displayed.

Unfortunately,my task tray is located in the bottom right of my screen, yet it's position is X: 1369 Y: 1.(Variable based on what apps are running, minimized, etc)

Since my screen res is 1680x1050, I would expect the position to be close to X: 1369 Y: 1000, since the task tray is only one line tall.

So, I'm processing the icons from right to left ( Start at the clock, and move towards the Start Button) but once i'm outside the bounds of the task tray, quit looking.

So what I want to do is say

Func FindTrayIcon ( $WinTitle )
    $xpos = @DesktopWidth - 103
    $yPos = @DesktopHeight - 15
    
    ControlGetPos ( "", "", "ToolbarWindow321" )
    msgBox ( 0 , "" , "X = " & $xpos & @CR & "Y = " & $ypos )
    $Found = 0
    While NOT $Found
        MouseClick ( "secondary" , $xpos, $ypos )
        Wait ( 1 )
        If WinActive ( $WinTitle , "" ) Then
            $Found = 1
            $strCoordinates = $xpos & "," & $ypos
            MsgBox ( 0 , "Information" , "Found """ & $WinTitle & """ Icon at " & $strCoordinates )
        EndIf
        $xpos = $xpos - 18
        Send ( "{ESC}" )
       ; If we've reached the end of the tasktray, exit the loop
    Wend

    Send ( "{ESC}" )
    Return $strCoordinates
EndFunc
Link to comment
Share on other sites

No I Cant. Basically what I'm trying to do is "Count" how many icons are in the Windows Task Tray. I want to look at each one, and make sure certain ones are displayed.

Unfortunately,my task tray is located in the bottom right of my screen, yet it's position is X: 1369 Y: 1.(Variable based on what apps are running, minimized, etc)

Since my screen res is 1680x1050, I would expect the position to be close to X: 1369 Y: 1000, since the task tray is only one line tall.

So, I'm processing the icons from right to left ( Start at the clock, and move towards the Start Button) but once i'm outside the bounds of the task tray, quit looking.

So what I want to do is say

Func FindTrayIcon ( $WinTitle )
    $xpos = @DesktopWidth - 103
    $yPos = @DesktopHeight - 15
    
    ControlGetPos ( "", "", "ToolbarWindow321" )
    msgBox ( 0 , "" , "X = " & $xpos & @CR & "Y = " & $ypos )
    $Found = 0
    While NOT $Found
        MouseClick ( "secondary" , $xpos, $ypos )
        Wait ( 1 )
        If WinActive ( $WinTitle , "" ) Then
            $Found = 1
            $strCoordinates = $xpos & "," & $ypos
            MsgBox ( 0 , "Information" , "Found """ & $WinTitle & """ Icon at " & $strCoordinates )
        EndIf
        $xpos = $xpos - 18
        Send ( "{ESC}" )
      ; If we've reached the end of the tasktray, exit the loop
    Wend

    Send ( "{ESC}" )
    Return $strCoordinates
EndFunc
i am pretty sure there is already a script to do something to this effect. i want to say about 8 months ago there was a script to identify the icons in the systray; it was made because of someone wanting to know when a specific icon disappeared. search for systray or tray icons in this forum and in scripts and scraps
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...