Jump to content

SysTray_UDF.au3


gertsolo
 Share

Recommended Posts

Hey,

when running this example code

#include "SysTray_UDF.au3"
MsgBox(0, "count", _SystrayIconCount ())
For $p = 0 To _SystrayIconCount ()
   ConsoleWrite(@CR & "#" & $p & "Tooltip: " & _SysTrayIconTooltip ($p))
Next
MsgBox(0, "Tooltip", _SysTrayIconTooltip (_SysTrayIconIndex ("Feedreader.exe")))
; -- Example 1 --
; Get window titles of all windows that have icon on systray
$iTitles = _SysTrayIconTitles ()
; Get process names of all processes that have icon on systray
$iProcesses = _SysTrayIconProcesses ()
For $i = 0 To UBound($iTitles) - 1
 ; write the info to consolewindow
   ConsoleWrite(@CR & "#" & $i & "Title: " & $iTitles[$i] & ", process: " & $iProcesses[$i])
Next

I get the following error:

Error: Could not find toolbar process id, 2

#0Tooltip: -1Error: Could not find toolbar process id, 2

#1Tooltip: -1Error: Could not find toolbar process id, 2

#2Tooltip: -1Error: Could not find toolbar process id, 2

#3Tooltip: -1Error: Could not find toolbar process id, 2

#4Tooltip: -1Error: Could not find toolbar process id, 2

#5Tooltip: -1Error: Could not find toolbar process id, 2

#6Tooltip: -1Error: Could not find toolbar process id, 2

#7Tooltip: -1Error: Could not find toolbar process id, 2

#8Tooltip: -1Error: Could not find toolbar process id, 2

#9Tooltip: -1Error: Could not find toolbar process id, 2

#10Tooltip: -1Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

Error: Could not find toolbar process id, 2

#0Title: , process: SciTE.exe

#1Title: , process: SciTE.exe

#2Title: , process: SciTE.exe

#3Title: , process: SciTE.exe

#4Title: , process: SciTE.exe

#5Title: , process: SciTE.exe

#6Title: , process: SciTE.exe

#7Title: , process: SciTE.exe

#8Title: , process: SciTE.exe

#9Title: , process: SciTE.exe>Exit code: 0 Time: 4.732

Any ideas? Edited by gertsolo

The more you learn, the less you know.

Link to comment
Share on other sites

This works fine for me:

#include "SysTray_UDF.au3"

ConsoleWrite("count = " & _SystrayIconCount () & @LF)
For $p = 0 To _SystrayIconCount ()
   ConsoleWrite($p & ": Tooltip: " & _SysTrayIconTooltip ($p) & @LF)
Next

; Get window titles of all windows that have icon on systray
$iTitles = _SysTrayIconTitles ()
; Get process names of all processes that have icon on systray
$iProcesses = _SysTrayIconProcesses ()
For $i = 0 To UBound($iTitles) - 1
; write the info to consolewindow
   ConsoleWrite($i & ": Title: " & $iTitles[$i] & ", process: " & $iProcesses[$i] & @LF)
Next

All I did was download the latest version of SysTray_UDF.au3 (what version do you have?), and take out the annoying MsgBox's.

Output:

>Running:(3.2.10.0):C:\Program Files\AutoIt3\autoit3.exe "C:\temp\Test\Test2.au3"   
count = 10
0: Tooltip: No tooltip text
1: Tooltip: No tooltip text
2: Tooltip: No tooltip text
3: Tooltip: No tooltip text
4: Tooltip: No tooltip text
5: Tooltip: No tooltip text
6: Tooltip: Volume (muted)
7: Tooltip: Safely Remove Hardware
8: Tooltip: OpenOffice.org 2.3 Quickstarter
9: Tooltip: Symantec AntiVirus
10: Tooltip: No tooltip text
0: Title: Connections Tray, process: explorer.exe
1: Title: Connections Tray, process: explorer.exe
2: Title: Connections Tray, process: explorer.exe
3: Title: Connections Tray, process: explorer.exe
4: Title: Connections Tray, process: explorer.exe
5: Title: Connections Tray, process: explorer.exe
6: Title: Power Meter, process: explorer.exe
7: Title: Power Meter, process: explorer.exe
8: Title: ---No title---, process: soffice.bin
9: Title: Symantec AntiVirus, process: VPTray.exe
+>14:51:06 AutoIT3.exe ended.rc:0
>Exit code: 0   Time: 1.673

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

This is the one I have:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1 Beta
; Author:        Tuape
;
; Script Function:
;   Systray UDF - Functions for reading icon info from system tray / removing 
;   any icon.
;
; Last Update: 7/14/05
; Requirements: AutoIt3 Beta - tested on WindowsXP, might also work in win2000
;
; Functions:
; _SysTrayIconCount() - Get count of all systray icons
; _SysTrayIconTitles() - Get titles of all programs that have icon on systray
; _SysTrayIconProcesses() - Get list of all process names that have icon in systray (hidden or visible)
; _SysTrayIconPids() - Get list of all parent process id's that own an icon in systray (hidden or visible)
; _SysTrayIconRemove($index) - Remove icon (removes completely, not just hide)
; _SysTrayIconIndex($wintitle or $process) - Get icon index based on process name or wintitle
; _SysTrayIconTooltip($index) - Get tooltip text of an icon based on index
;
; Notes:
; Some systray icons are actually hidden, so _SysTrayIconCount will probably return more than you see on systray.
; Some icons don't have window title on them. However, _SysTrayIconPids() & _SysTrayIconProcesses
; do return correct (parent) pid or process name
; ----------------------------------------------------------------------------
Edited by gertsolo

The more you learn, the less you know.

Link to comment
Share on other sites

This is the one I have:

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.1 Beta
; Author:        Tuape
;
; Script Function:
;   Systray UDF - Functions for reading icon info from system tray / removing 
;   any icon.
;
; Last Update: 7/14/05
; Requirements: AutoIt3 Beta - tested on WindowsXP, might also work in win2000
;
; Functions:
; _SysTrayIconCount() - Get count of all systray icons
; _SysTrayIconTitles() - Get titles of all programs that have icon on systray
; _SysTrayIconProcesses() - Get list of all process names that have icon in systray (hidden or visible)
; _SysTrayIconPids() - Get list of all parent process id's that own an icon in systray (hidden or visible)
; _SysTrayIconRemove($index) - Remove icon (removes completely, not just hide)
; _SysTrayIconIndex($wintitle or $process) - Get icon index based on process name or wintitle
; _SysTrayIconTooltip($index) - Get tooltip text of an icon based on index
;
; Notes:
; Some systray icons are actually hidden, so _SysTrayIconCount will probably return more than you see on systray.
; Some icons don't have window title on them. However, _SysTrayIconPids() & _SysTrayIconProcesses
; do return correct (parent) pid or process name
; ----------------------------------------------------------------------------
I believe taupe has updated the code without tweaking the header text and version number, as recently as January 2008. When did you last down load it?

URL: Example Scripts: SysTray_UDF.au3

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...