# SysTray_UDF

## Recommended Posts

No offense to you quaizywabbit (I'm just asking a question), but if the function is not used more than once, does it make any difference whether or not it is a variable? Did you mention it because it makes readability better?

EDIT: I have gone to this point, but then explorer crashes on my windows xp system. Did I do something stupid?

$index = 0$hndl = _FindTrayToolbarWindow()
$lResult = DLLCall("user32.dll","int","SendMessage", "hwnd",$hndl, "int", $TB_GETBUTTONTEXT, "int",$index, "ptr", "")
;MsgBox(0,"",$lResult[0])$bufferptr = DllStructCreate ("char[256]");" & $lResult[0] + 1 & " ;MsgBox(0,"",DllStructGetPtr($bufferptr))
$lResult = DLLCall("user32.dll","int","SendMessage", "hwnd",$hndl, "int", $TB_GETBUTTONTEXT, "int",$index, "ptr", DllStructGetPtr($bufferptr)) Edited by this-is-me Who else would I be? ##### Link to post ##### Share on other sites • Replies 106 • Created • Last Reply #### Top Posters In This Topic #### Top Posters In This Topic No offense to you quaizywabbit (I'm just asking a question), but if the function is not used more than once, does it make any difference whether or not it is a variable? Did you mention it because it makes readability better? EDIT: I have gone to this point, but then explorer crashes on my windows xp system. Did I do something stupid? $index = 0
$hndl = _FindTrayToolbarWindow()$lResult = DLLCall("user32.dll","int","SendMessage", "hwnd", $hndl, "int",$TB_GETBUTTONTEXT, "int", $index, "ptr", "") ;MsgBox(0,"",$lResult[0])
$bufferptr = DllStructCreate ("char[256]");" &$lResult[0] + 1 & "
;MsgBox(0,"",DllStructGetPtr($bufferptr))$lResult = DLLCall("user32.dll","int","SendMessage", "hwnd", $hndl, "int",$TB_GETBUTTONTEXT, "int", $index, "ptr", DllStructGetPtr($bufferptr))
I thik button ID should be the id on struct TB_BUTTON, 2. Unfortunately I'm away for a while, but if you can't get this working I could try it during the weekend.
##### Share on other sites

Thanks, tuape. I will look into it.

Who else would I be?
##### Share on other sites

What am i missing?

i got the latest beta, but when i run this script nothing happens.

EDIT:

Sorry i must be a little tarded today

i figured it out.

i really need to learn to read all through a script before i go and run it

Edited by random667

It is really sad to see a family torn apart by something as simple as a pack of wolves.

##### Share on other sites

@Tuape: Good job!

This UDF ist very useful to me.

But one little thing is annoying me: I always use the option "MustDeclareVars". This doesn't work with your UDF. Can you improve this please.

Thx a lot :-)

Cu,

Buffo

##### Share on other sites

@Tuape: Good job!

This UDF ist very useful to me.

But one little thing is annoying me: I always use the option "MustDeclareVars". This doesn't work with your UDF. Can you improve this please.

Thx a lot :-)

Cu,

Buffo

@Buffo: Modified the first post. Hopefully I didn't break anything.

@this-is-me: Did you get it working?

@tuape, no I did not. I continued to have issues related to my poor knowledge of API calls. If you have some time, would you mind adding a _SysTrayIconGetTooltip($iIndex=0) to your wonderful library? Who else would I be? ##### Link to post ##### Share on other sites I used beta version and got no error but nothing else happened either. Hide/Unhide/remove icon functions are not working in my system. I'm using Win2k Eng Pro Rollup 1. Edited by somh ##### Link to post ##### Share on other sites • 1 month later... DUH i jsute donwload the latest (3.1.1.86) beta and try jsut to run your example of clicking on outlook icon but it doesn't work because it says that it doesn't know the hwnd function... SysTray_UDF.au3(73,35) : ERROR: HWnd(): undefined function. If$info[$i] = HWnd($var[$j][1]) what have i missed ??? because i want to right click on an application (netsetman int this case) to chose one of the menu index testeu.au3 ##### Link to post ##### Share on other sites psychotik2k3, I was getting the same error. I use the Scite editor. It was configured to use "/prod" and not "/beta". If you are using Scite, then either use the BETA Run/Compile menu or modify the command in the "au3.properties" of the scite folder. au3.properties: ----------------- command.go.$(file.patterns.au3)="$(SciteDefaultHome)\CompileAU3\CompileAU3.exe" /run /beta /ErrorStdOut /in "$(FilePath)" /autoit3dir "$(autoit3dir)" /UserParams$(1) $(2)$(3) $(4) command.build.$(file.patterns.au3)="$(SciteDefaultHome)\CompileAU3\CompileAU3.exe" /beta /CompileDefaults /in "$(FilePath)" /autoit3dir "$(autoit3dir)" this is an excellent UDF! good luck DUH i jsute donwload the latest (3.1.1.86) beta and try jsut to run your example of clicking on outlook icon but it doesn't work because it says that it doesn't know the hwnd function... SysTray_UDF.au3(73,35) : ERROR: HWnd(): undefined function. If$info[$i] = HWnd($var[$j][1]) what have i missed ??? because i want to right click on an application (netsetman int this case) to chose one of the menu index ##### Link to post ##### Share on other sites • 3 weeks later... I hope this gets added to the list of default AutoIt3 UDF libraries! Angel ##### Link to post ##### Share on other sites Heh... I was making a script to read my upload/download speeds from µTorrent. What I'm corrently doing is iterating through the listview of torrents and reading the speeds of each one and summing them. But the window doesn't update these numbers unless the window is actually VISIBLE and RESTORED, making it quite annoying. Worse yet, I can't restore it via script, the tray icon needs to be clicked, otherwise the window won't update. Anyways... it would be alot simpler to use a tray tooltip reading function, since µTorrent puts the overall speeds right there. I'm looking forward to a version of this UDF that'll support that! Const$TBBUTTON = "int;int;byte;byte;byte;ptr;ptr"
Const $TB_GETBUTTON = 1047 Const$TB_GETBUTTONTEXT = 1069

Opt("WinSearchChildren", 1)
Opt("WinTitleMatchMode", 3)
$hwnd = WinGetHandle("Notification Area")$info = DllStructCreate($TBBUTTON)$success = 1
$i = 0 While$success <> 0
$ret = DllCall("user32.dll","int","SendMessageA", "hwnd",$hwnd, "int", $TB_GETBUTTON, "int",$i, "ptr", DllStructGetPtr($info)) If @error <> 0 Then MsgBox(0, "", "Error") Exit EndIf$success = $ret[0] If$success <> 0 Then
$idcommand = DllStructGetData($info, 2)

$ret = DllCall("user32.dll","int","SendMessageA", "hwnd",$hwnd, "int", $TB_GETBUTTONTEXT, "int",$idcommand, "str", "")
MsgBox(0, "", $ret[4])$i = $i + 1 EndIf WEnd DllStructDelete($info)

I just wrote this code snippit, which is supposed to iterate through all the systray buttons and MsgBox their tooltips.

But, it crashes explorer on the first DllCall. Not sure why.

BTW, I'm not even sure if this, if it worked, would return the text neeced. A TB_GETTOOLTIPS might be needed, with a TIM_GETTEXT directed at the tooltip control after that.

Edited by The_Mega_ZZTer
##### Share on other sites

Hi,

I'm trying this out on W2K. Running beta 3.1.1.93. When I include the UDF I get the following error message:

(59): Array variable subscript badly formatted.:

Local $info[$max]

Local $info[^ ERROR I have #include <SysTray_UDF.au3> in my script and am using Alt-F5 to run. Am I doing something wrong? Thanks VW ##### Link to post ##### Share on other sites • 4 weeks later... Hi, I am trying to use your Systray_UDF and get the following error D:\AutoIT\SysTray_UDF.au3 (414) : ==> Unknown function name.: DllStructDelete($TBBUTTON)

^ ERROR

Any idea why ?

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

##### Share on other sites

Hi,

I am trying to use your Systray_UDF and get the following error

D:\AutoIT\SysTray_UDF.au3 (414) : ==> Unknown function name.:

DllStructDelete($TBBUTTON) ^ ERROR Any idea why ? The UDF needs to be updated, DllStructDelete no longer exists in the beta. Don't argue with an idiot; people watching may not be able to tell the difference. ##### Link to post ##### Share on other sites The UDF needs to be updated, DllStructDelete no longer exists in the beta. Looks like I am stuffed unless Tuape decides to update it as I do not have that sort of skills. Thanks for the answer. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother ##### Link to post ##### Share on other sites Looks like I am stuffed unless Tuape decides to update it as I do not have that sort of skills. Thanks for the answer. This should fix it for you. Edited by gafrost Don't argue with an idiot; people watching may not be able to tell the difference. ##### Link to post ##### Share on other sites This should fix it for you. Thanks, It worked a treat. You are a star. Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother ##### Link to post ##### Share on other sites • 2 weeks later... This should fix it for you. Does it still work with last beta (v3.1.1.101)? Edited by masvil ##### Link to post ##### Share on other sites • 3 weeks later... G'day, Is anyone using this UDF successfully with Win2K? The UDF works for me in XP, but in W2K, although it runs the results are not correct. For instance one of the example scripts is supposed to list the processes that "own" icons on the systray. ; 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

When I run this code on W2K, this is the result that I get:

"C:\Data\SysTray.au3" /autoit3dir "C:\Program Files\AutoIt3\beta" /UserParams
>Running AU3Check   C:\Program Files\AutoIt3\SciTE\Defs\Unstable\Au3Check\au3check.dat
>AU3Check Ended. No Error(s).
>Running: (3.1.1.104):C:\Program Files\AutoIt3\beta\autoit3.exe "C:\Data\SysTray.au3"
#0Title: , process: SciTe.exe
#1Title: , process: SciTe.exe
#2Title: , process: SciTe.exe
#3Title: , process: SciTe.exe
#4Title: , process: SciTe.exe
#5Title: , process: SciTe.exe
>AutoIT3.exe ended.
>Exit code: 0   Time: 4.456

This is not correct, the number of processes is about right, but none of them belong to the editor.

Also, a general question on using the beta. At the moment to get the include to work I am having to specify the full path to the UDF in the beta\include directory. There must be a default path somewhere for includes, can someone tell me where this is.

Thanks,

VW

## Create an account

Register a new account

• ### Recently Browsing   0 members

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...