Jump to content

SysTray_UDF


tuape
 Share

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 comment
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.
Link to comment
Share on other sites

What am i missing?

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

:mad2:

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 :P

Edited by random667

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

Link to comment
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

Link to comment
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?

Link to comment
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 comment
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 comment
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 comment
Share on other sites

  • 3 weeks later...

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. :P 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
Link to comment
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 comment
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

Link to comment
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.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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 comment
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

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

This should fix it for you.

Thanks, It worked a treat.

You are a star. :P


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 comment
Share on other sites

  • 2 weeks later...
  • 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

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...