AutoHotkey Community

It is currently May 27th, 2012, 3:28 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 15 posts ] 
Author Message
PostPosted: October 13th, 2005, 8:00 pm 
Offline

Joined: September 30th, 2005, 5:15 pm
Posts: 58
Location: Fort Wayne, IN
Is there a way in AHK to right click on a tray icon so the context menu is displayed?

I know the applicantion's name and PID.

I've tried using WinActivate, but it doesn't set focus on the icon. If I can get focus on the icon, then I can send the {APPSKEY} keystroke to show the context menu.

Thanks,
Dean


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 13th, 2005, 10:19 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
The code below will activate the AHk tray menu.

current limitation: target image must be unique and static

Code:
Sleep, 100

hw_notification := FindWindow( "Shell_TrayWnd|TrayNotifyWnd|SysPager|ToolbarWindow32,Notification Area" )

WinGetPos, s_x, s_y, s_w, s_h, ahk_id %hw_notification%

CoordMode, Pixel, Screen
ImageSearch, t_x, t_y, s_x, s_y, s_x+s_w-1, s_y+s_h-1, *Icon1 %A_ProgramFiles%\autohotkey\autohotkey.exe

if ( ErrorLevel = 0 )
{
   CoordMode, Mouse, Screen
   MouseClick, Right, t_x, t_y, 1
}
return

FindWindow( p_tree )
{
   level_total = 0

   loop, parse, p_tree, |
   {
      level_total++
      
      ix := InStr( a_LoopField, "," )

      if ( ix )
      {
         StringMid, tree[%level_total%]?class, a_LoopField, 1, ix-1
         StringMid, tree[%level_total%]?title, a_LoopField, ix+1, StrLen( a_LoopField )-ix
      }
      else
      {
         tree[%level_total%]?class := a_LoopField
         tree[%level_total%]?title = 0
      }
   }
   
   hw_parent = 0
   hw_child = 0
   
   level = 1
   
   loop,
   {
      hw_child := FindWindowEx( hw_parent, hw_child, tree[%level%]?class, tree[%level%]?title )

      if ( hw_child )
      {
         if ( level = level_total )
            return, hw_child
      
         level++
         
         hw_parent_old := hw_parent
         hw_parent := hw_child
         
         hw_child_old := hw_child   
         hw_child = 0
      }
      else
      {
         if ( level = 1 )
            return, 0
      
         level--
         
         hw_parent := hw_parent_old
         
         hw_child := hw_child_old
      }
   }
}

FindWindowEx( p_hw_parent, p_hw_child, p_class, p_title=0 )
{
   if ( p_title = 0 )
      type_title = uint
   else
      type_title = str

   return, DllCall( "FindWindowEx"
                  , "uint", p_hw_parent
                  , "uint", p_hw_child
                  , "str", p_class
                  , type_title, p_title )
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 18th, 2005, 4:24 am 
Offline

Joined: September 30th, 2005, 5:15 pm
Posts: 58
Location: Fort Wayne, IN
Thanks for the quick reply.

Your solution of looking for the icon is interesting. I'll play around with it some more, but I see two immediate problems. I'm trying to right click on the tray icon for my Nortel VPN connection. The icon changes color as data is sent/received. I guess I could look for more than one icon.

Also, I assume the icon won't be found if the icon gets auto-hidden (because it has not been used for a while).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 18th, 2005, 8:40 am 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
There is a better way. I will provide the code for you, with the following disclaimer:

The following code has been tested with Windows XP SP2. It lacks comprehensive error checking and due to differences between systems, and especially between versions of Windows, may cause the Windows shell (i.e., Explorer) to crash.

If you're willing to run the code and report back the information presented in each dialog -- especially that in the "button information" dialog -- then I can help you further.

Code:
WM_USER = 0x400

hw_notification_area := FindWindow( "Shell_TrayWnd|TrayNotifyWnd|SysPager|ToolbarWindow32,Notification Area" )
MsgBox, hw_notification_area = %hw_notification_area%

VarSetCapacity( pid_explorer, 4 )

WinGet, pid_explorer, PID, ahk_id %hw_notification_area%
MsgBox, pid_explorer: %pid_explorer%

hp_explorer := DllCall( "OpenProcess", "uint", 0x8|0x10, "int", true, "uint", pid_explorer )
MsgBox, openprocess: %ErrorLevel% - %hp_explorer%

remote_buffer := DllCall( "VirtualAllocEx"
                     , "uint", hp_explorer
                     , "uint", 0
                     , "uint", 0x1000
                     , "uint", 0x1000
                     , "uint", 0x4 )
MsgBox, virtualallocex: %ErrorLevel% - %remote_buffer%

TB_BUTTONCOUNT := WM_USER+24
SendMessage, TB_BUTTONCOUNT, 0, 0,, ahk_id %hw_notification_area%
MsgBox, button count = %ErrorLevel%

TB_GETBUTTON := WM_USER+23
SendMessage, TB_GETBUTTON, 0, remote_buffer,, ahk_id %hw_notification_area%
MsgBox, TB_GETBUTTON: %ErrorLevel%

remote_buffer2 := remote_buffer+200

TB_GETITEMRECT := WM_USER+29
SendMessage, TB_GETITEMRECT, index, remote_buffer2,, ahk_id %hw_notification_area%
MsgBox, TB_GETITEMRECT: %ErrorLevel%

VarSetCapacity( buffer, 1000, 0 )
VarSetCapacity( buffer_actual_size, 4, 0 )

pBuffer2 := &buffer+200

result := DllCall( "ReadProcessMemory"
                  , "uint", hp_explorer
                  , "uint", remote_buffer
                  , "uint", &buffer
                  , "uint", 1000
                  , "uint", &buffer_actual_size )
buffer_actual_size := ReadInteger( "uint", &buffer_actual_size, 0 )
MsgBox, readprocessmemory: %ErrorLevel% - %result% ~ %buffer_actual_size%

; -- data --
VarSetCapacity( buffer2, 1000, 0 )
VarSetCapacity( buffer_actual_size, 4, 0 )

result := DllCall( "ReadProcessMemory"
                  , "uint", hp_explorer
                  , "uint", ReadInteger( "int", &buffer, 12 )
                  , "uint", &buffer2
                  , "uint", 1000
                  , "uint", &buffer_actual_size )
buffer_actual_size := ReadInteger( "uint", &buffer_actual_size, 0 )
MsgBox, readprocessmemory: %ErrorLevel% - %result% ~ %buffer_actual_size%

; -- string --
VarSetCapacity( buffer3, 1000, 0 )
VarSetCapacity( buffer_actual_size, 4, 0 )

result := DllCall( "ReadProcessMemory"
                  , "uint", hp_explorer
                  , "uint", ReadInteger( "int", &buffer, 16 )
                  , "uint", &buffer3
                  , "uint", 1000
                  , "uint", &buffer_actual_size )
buffer_actual_size := ReadInteger( "uint", &buffer_actual_size, 0 )
MsgBox, readprocessmemory: %ErrorLevel% - %result% ~ %buffer_actual_size%

MsgBox, %
   ( Join
      "-- [" A_Index-1 "] button information --"
      "`n`ncommand = " ReadInteger( "int", &buffer, 4 )
      "`nstate = " ReadInteger( "uchar", &buffer, 8 )
      "`ndata = " ReadInteger( "uint", &buffer, 12 )
      "`nstring = " ReadInteger( "int", &buffer, 16 )
      "`n`nrect = " ReadInteger( "int", pBuffer2, 0, false )
         ", " ReadInteger( "int", pBuffer2, 4, false )
         ", " ReadInteger( "int", pBuffer2, 8, false )
         ", " ReadInteger( "int", pBuffer2, 12, false )
      "`n`ndata = " ReadInteger( "uint", &buffer2, 0 )
      "`nstring = " ReadStringA( &buffer3, 0, 1000 )
   )
ExitApp

TwosComplement( p_value, p_size )
{
   return, ( p_value^( 2**( p_size*8 )-1 ) )+1
}

ReadInteger( p_type, p_address, p_offset, p_hex=true )
{
   old_FormatInteger := a_FormatInteger

   if ( p_hex )
      SetFormat, integer, hex
   else
      SetFormat, integer, dec
     
   if ( p_type = "int" )
   {
      sign := true
      size = 4
   }
   else if ( p_type = "uint" )
   {
      sign := false
      size = 4
   }
   else if ( p_type = "short" )
   {
      sign := true
      size = 2
   }
   else if ( p_type = "ushort" )
   {
      sign := false
      size = 2
   }
   else if ( p_type = "char" )
   {
      sign := true
      size = 1
   }
   else if ( p_type = "uchar" )
   {
      sign := false
      size = 1
   }
   else
      MsgBox, [ReadInteger] error: the type %p_type% is undefined!

   value = 0

   loop, %size%
      value := value+( *( ( p_address+p_offset )+( a_Index-1 ) ) << ( 8*( a_Index-1 ) ) )
     
   if ( sign )
   {
      sign := ( *( p_address+p_offset+( size-1 ) ) ) >> 7
     
      if ( sign )
         value := -1*TwosComplement( value, size )
   }
     
   SetFormat, integer, %old_FormatInteger%

   return, value
}

ReadStringA( p_address, p_offset, p_size )
{
   text=
   
   address := p_address+p_offset-2

   loop, %p_size%
   {
      address += 2
   
      if ( *( address ) = 0 )
         break
     
      text := text Chr( *( address ) )
   }
   
   return, text
}

FindWindow( p_tree )
{
   level_total = 0

   loop, parse, p_tree, |
   {
      level_total++
     
      ix := InStr( a_LoopField, "," )

      if ( ix )
      {
         StringMid, tree[%level_total%]?class, a_LoopField, 1, ix-1
         StringMid, tree[%level_total%]?title, a_LoopField, ix+1, StrLen( a_LoopField )-ix
      }
      else
      {
         tree[%level_total%]?class := a_LoopField
         tree[%level_total%]?title = 0
      }
   }
   
   hw_parent = 0
   hw_child = 0
   
   level = 1
   
   loop,
   {
      hw_child := FindWindowEx( hw_parent, hw_child, tree[%level%]?class, tree[%level%]?title )

      if ( hw_child )
      {
         if ( level = level_total )
            return, hw_child
     
         level++
         
         hw_parent_old := hw_parent
         hw_parent := hw_child
         
         hw_child_old := hw_child   
         hw_child = 0
      }
      else
      {
         if ( level = 1 )
            return, 0
     
         level--
         
         hw_parent := hw_parent_old
         

         hw_child := hw_child_old
      }
   }
}

FindWindowEx( p_hw_parent, p_hw_child, p_class, p_title=0 )
{
   if ( p_title = 0 )
      type_title = uint
   else
      type_title = str

   return, DllCall( "FindWindowEx"
                  , "uint", p_hw_parent
                  , "uint", p_hw_child
                  , "str", p_class
                  , type_title, p_title )
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 18th, 2005, 12:41 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Wow, that's amazing! Thanks for posting it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 18th, 2005, 5:02 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
Chris wrote:
Thanks for posting it.


Remember, it is a work in progress and review the disclaimer before running the script. It is intended to provide deanhill1971 with the best possible answer to his specific question [and further my own education].


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 24th, 2005, 8:26 pm 
Offline

Joined: September 30th, 2005, 5:15 pm
Posts: 58
Location: Fort Wayne, IN
Thanks shimanov.

At a high level I understand your script, but I have a couple questions.
The script says there are 13 "buttons". Is this the number of tray icons?

The last msgbox displayed by the script shows:

-- [-1] button information --
command = 0xc
state = 0x4
data = 0x16ec80
string = 0x120528
rect = 0, 0, 18, 18
data = 0x4053c
string = ActivateTrayIcon2.ahk

How can I use this resulting info to send a right click to the icon? Also, if there are 13 buttons, how do I iterate through all 13 so I can use the "string" value to find the one I want?

Thanks for all your help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 25th, 2005, 8:03 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
deanhill1971 wrote:
The script says there are 13 "buttons". Is this the number of tray icons?


Yes and no. The tray notification area is implemented, in part, by a standard toolbar control. The icons are visible manifestations of the buttons within that toolbar. The number of buttons/icons may be more than are actually present. This is because there may be buttons which are not visible, but are not otherwise "hidden".

Quote:
How can I use this resulting info to send a right click to the icon?


The first step was to verify the script's operation on your system. Since it is functioning normally, I have attached another script which actually implements the function requested in your original post.

Assign the PID of interest to "pid_target" and run the script.

Limitations:

* Given a PID, there is no way to unambiguously select the target icon. This may be an issue if there is more than one icon in the tray associated with a given process.
* This method requires that the icon of interest be visible in the tray, in order to properly activate the icon's associated context menu. There is another method, which permits directly informing the icon's associated window of a relevant event. The simplest implementation of such a method, will require user interaction to implement. A completely automated implementation will require external (i.e., a custom program) help.

Code:
#NoTrayIcon

DetectHiddenWindows, On

OnExit, HandleExit

pid_target = 2532

hw_notification_area := FindWindow( "Shell_TrayWnd|TrayNotifyWnd|SysPager|ToolbarWindow32,Notification Area" )
if ( ErrorLevel or ! hw_notification_area )
{
   MsgBox, [error] FindWindow failed: ToolbarWindow32,Notification Area
   ExitApp
}

WinGet, pid_explorer, PID, ahk_id %hw_notification_area%
if ( ErrorLevel or ! pid_explorer )
{
   MsgBox, [error] WinGet~PID failed: explorer
   ExitApp
}

hp_explorer := DllCall( "OpenProcess"
                     , "uint", 0x18                              ; PROCESS_VM_OPERATION|PROCESS_VM_READ
                     , "int", false
                     , "uint", pid_explorer )
if ( ErrorLevel or ! hp_explorer )
{
   MsgBox, [error] OpenProcess failed: explorer
   ExitApp
}

remote_buffer_size = 0x1000
remote_buffer := DllCall( "VirtualAllocEx"
                     , "uint", hp_explorer
                     , "uint", 0
                     , "uint", remote_buffer_size
                     , "uint", 0x1000                           ; MEM_COMMIT
                     , "uint", 0x4 )                              ; PAGE_READWRITE
if ( ErrorLevel or ! remote_buffer )
{
   MsgBox, [error] VirtualAllocEx failed: explorer ~ remote_buffer
   ExitApp
}

; TB_BUTTONCOUNT
SendMessage, 0x418, 0, 0,, ahk_id %hw_notification_area%
button_count := ErrorLevel

buffer_size = 40
VarSetCapacity( buffer, buffer_size )

loop, %button_count%
{
   ; TB_GETBUTTON
   SendMessage, 0x417, A_Index-1, remote_buffer,, ahk_id %hw_notification_area%
   if ( ! ErrorLevel )
   {
      MsgBox, [error] SendMessage~TB_GETBUTTON failed: hw_notification_area
      ExitApp
   }
   
   result := DllCall( "ReadProcessMemory"
                  , "uint", hp_explorer
                  , "uint", remote_buffer
                  , "uint", &buffer
                  , "uint", buffer_size
                  , "uint", 0 )
   if ( ErrorLevel or ! result )
   {
      MsgBox, [error] ReadProcessMemory failed: explorer ~ remote_buffer (TB_GETBUTTON)
      ExitApp
   }
                  
   data_address := *( &buffer+12 )+( ( *( &buffer+13 ) ) << 8 )+( ( *( &buffer+14 ) ) << 16 )+( ( *( &buffer+15 ) ) << 24 )
   
   result := DllCall( "ReadProcessMemory"
                     , "uint", hp_explorer
                     , "uint", data_address
                     , "uint", &buffer
                     , "uint", buffer_size
                     , "uint", 0 )
   if ( ErrorLevel or ! result )
   {
      MsgBox, [error] ReadProcessMemory failed: explorer ~ data_address
      ExitApp
   }
   
   wid := *( &buffer )+( ( *( &buffer+1 ) ) << 8 )+( ( *( &buffer+2 ) ) << 16 )+( ( *( &buffer+3 ) ) << 24 )
   
   WinGet, pid, PID, ahk_id %wid%
   
   if ( pid = pid_target )
   {
      ; TB_GETITEMRECT
      SendMessage, 0x41D, A_Index-1, remote_buffer,, ahk_id %hw_notification_area%
      if ( ! ErrorLevel )
      {
         MsgBox, [error] SendMessage~TB_GETITEMRECT failed: hw_notification_area
         ExitApp
      }
      
      result := DllCall( "ReadProcessMemory"
                        , "uint", hp_explorer
                        , "uint", remote_buffer
                        , "uint", &buffer
                        , "uint", buffer_size
                        , "uint", 0 )
      if ( ErrorLevel or ! result )
      {
         MsgBox, [error] ReadProcessMemory failed: explorer ~ remote_buffer (TB_GETITEMRECT)
         ExitApp
      }
      
      WinGetPos, x, y,,, ahk_id %hw_notification_area%

      x := x+*( &buffer )+( ( *( &buffer+1 ) ) << 8 )+( ( *( &buffer+2 ) ) << 16 )+( ( *( &buffer+3 ) ) << 24 )+8
      y := y+*( &buffer+4 )+( ( *( &buffer+5 ) ) << 8 )+( ( *( &buffer+6 ) ) << 16 )+( ( *( &buffer+7 ) ) << 24 )+8
      
      CoordMode, Mouse, Screen
      MouseClick, Right, x, y, 1, 0
      
      break
   }
}
return

HandleExit:
   result := DllCall( "VirtualFreeEx"
                     , "uint", hp_explorer
                     , "uint", remote_buffer
                     , "uint", 0
                     , "uint", 0x8000 )                           ; MEM_RELEASE
   if ( ErrorLevel or ! result )
      MsgBox, [warning] VirtualFreeEx failed: explorer ~ remote_buffer
   
   result := DllCall( "CloseHandle", "uint", hp_explorer )
   if ( ErrorLevel or ! result )
      MsgBox, [warning] CloseHandle failed: explorer
ExitApp

FindWindow( p_tree )
{
   level_total = 0

   loop, parse, p_tree, |
   {
      level_total++
      
      ix := InStr( a_LoopField, "," )

      if ( ix )
      {
         StringMid, tree[%level_total%]?class, a_LoopField, 1, ix-1
         StringMid, tree[%level_total%]?title, a_LoopField, ix+1, StrLen( a_LoopField )-ix
      }
      else
      {
         tree[%level_total%]?class := a_LoopField
         tree[%level_total%]?title = 0
      }
   }
   
   hw_parent = 0
   hw_child = 0
   
   level = 1
   
   loop,
   {
      hw_child := FindWindowEx( hw_parent, hw_child, tree[%level%]?class, tree[%level%]?title )

      if ( hw_child )
      {
         if ( level = level_total )
            return, hw_child
      
         level++
         
         hw_parent_old := hw_parent
         hw_parent := hw_child
         
         hw_child_old := hw_child   
         hw_child = 0
      }
      else
      {
         if ( level = 1 )
            return, 0
      
         level--
         
         hw_parent := hw_parent_old
         
         hw_child := hw_child_old
      }
   }
}

FindWindowEx( p_hw_parent, p_hw_child, p_class, p_title=0 )
{
   if ( p_title = 0 )
      type_title = uint
   else
      type_title = str

   return, DllCall( "FindWindowEx"
                  , "uint", p_hw_parent
                  , "uint", p_hw_child
                  , "str", p_class
                  , type_title, p_title )
}


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 8:09 pm 
Offline

Joined: September 30th, 2005, 5:15 pm
Posts: 58
Location: Fort Wayne, IN
Wow, that works very well shimanov. :o
Thanks for all your assistance.


For my own education, I have another question. The script repositions the mouse to the tray icon and does a right click. Can the right click be done without moving the mouse?

For example:
I can manually press the Windows key then Escape to get to the task bar. If I then press Tab 2-3 times, the focus moves to the tray's arrow button (that looks like "<"). Then I can Right Arrow several times to the icon I want and press the Context Menu (aka right-click) key.

I ran the following experiments:
(1) I tried the following command to set focus to the tray icon, but it doesn't work.
Code:
ControlFocus, , ahk_id %wid%


(2) I used the following command. But both the right click for the icon and the right for the Task Bar popup. The right click for the icon pops up where the mouse is currently located.
Code:
x := *( &buffer )+( ( *( &buffer+1 ) ) << 8 )+( ( *( &buffer+2 ) ) << 16 )+( ( *( &buffer+3 ) ) << 24 )+8
y := *( &buffer+4 )+( ( *( &buffer+5 ) ) << 8 )+( ( *( &buffer+6 ) ) << 16 )+( ( *( &buffer+7 ) ) << 24 )+8
ControlClick, x%x% y%y%, ahk_id %hw_notification_area%, , RIGHT


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 8:16 pm 
Offline

Joined: August 19th, 2005, 4:36 pm
Posts: 14
Location: Germany
I have coded this recently to right click a icon in the notificationarea.
because it has a special color I was able to lock for a single pixel.
It works with the taskbar in all positions, even on the second screen, and if it is auto-hidden.



Code:
CoordMode,Pixel,Screen
CoordMode,Mouse,Screen
WinActivate,ahk_class Shell_TrayWnd                    ; Activate the taskbar
WinGetPos,XT,YT,,,ahk_class Shell_TrayWnd               ; Get its position
IfEqual,XT,,return
MouseMove,% XT,% YT                        ; put the mouse on it
Sleep,500                           ; Wait, perhaps it was auto-hidden
WinGetPos,XT,YT,,,ahk_class Shell_TrayWnd               ; Get its position again
ControlGetPos, X, Y, Width, Height, ToolBarWIndow321, ahk_class Shell_TrayWnd    ; get position of notification area
IfEqual,X,,return                           ; notification area not found
PixelSearch, X, Y,% X+XT,% Y+YT,% X+XT+width,% YT+Y+Height, 0x01C7FF , ,    ; search pixel in whole notification area
IfNotEqual,X,,MouseClick,right,%X%,%Y%,1,0,                ; got it, so click it right


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 8:56 pm 
Offline

Joined: September 25th, 2005, 4:31 pm
Posts: 610
deanhill1971 wrote:
Wow, that works very well shimanov. :o
Thanks for all your assistance.


Cool!

Quote:
The script repositions the mouse to the tray icon and does a right click. Can the right click be done without moving the mouse?


It is unlikely. Each program provides a custom handler for events associated with its tray icon. The standard notification does not explicitly specify position. For example, AHk determines position with the following code (independent of the event context):

Code:
GetCursorPos(&pt)


Quote:
For example:
I can manually press the Windows key then Escape to get to the task bar. If I then press Tab 2-3 times, the focus moves to the tray's arrow button (that looks like "<"). Then I can Right Arrow several times to the icon I want and press the Context Menu (aka right-click) key.


Again, the behavior related to the tray icon can be highly custom. For example, AHk will only react to left-button-down, left-button-double click, and right-button-up events.

With my current understanding, to position the menu over/near its associated tray icon, it is necessary for the mouse cursor to be at that position before triggering the menu. This seems to be the minimum standard behavior.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 26th, 2005, 10:53 pm 
Offline

Joined: September 30th, 2005, 5:15 pm
Posts: 58
Location: Fort Wayne, IN
Okay.

I'll start using the script this week.

Thanks again for the help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: icon search instead
PostPosted: May 1st, 2006, 4:29 am 
Offline

Joined: December 20th, 2005, 4:15 am
Posts: 165
Location: Malaysia
Shimanov's method probably works, but is too complicated for me. I went with hps's method instead.

hps's method involves doing a pixel search, but I've modified it to do an icon search instead.

This produces more accurate results, but you would need to find and extract the icon you're interested in first.

There are a number of icon utilities out there, but I go with IconsExtract - http://www.nirsoft.net/utils/iconsext.html (free)

What you need is the 16x16 icon embedded in the program - this is used by Windows for display in the system tray.

Save it as an ICO file, and ImageSearch will be able to look for it.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: July 3rd, 2006, 12:58 pm 
Thanks Shimanov,
I just love the second script though I wanted to add one thing - if any of you is trying to use it on a wink2 machine - at least in my case the win 2k machines couldn't run it.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 5th, 2006, 8:02 pm 
Offline

Joined: March 13th, 2006, 3:55 pm
Posts: 65
Location: Ottawa, Canada
Hi Rnon,

Try changing
Code:
hw_notification_area := FindWindow( "Shell_TrayWnd|TrayNotifyWnd|SysPager|ToolbarWindow32,Notification Area" )
to
Code:
  if A_OSVersion = WIN_XP
    hw_notification_area := FindWindow( "Shell_TrayWnd|TrayNotifyWnd|SysPager|ToolbarWindow32,Notification Area" )
  else
    hw_notification_area := FindWindow( "Shell_TrayWnd|TrayNotifyWnd|ToolbarWindow32" )

/ Louis


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 11 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group