AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Extract Informations about TrayIcons
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Wed Jul 16, 2008 7:43 am    Post subject: Reply with quote

Sean wrote:
Code:
NumGet(btn,12)
If it's zero, then can assume the OS is 64bit, otherwise 32bit.

I uploaded new one in the same link, combining both 32bit and 64bit into the single TrayIcons() on the basis that the above hypothesis is true. I don't really know if they're really padded with zero in 64bit Windows, however, judging from the result ACoder posted earlier it's likely. Anyway, it won't affect anything in 32bit Windows.
Back to top
View user's profile Send private message
ACoder
Guest





PostPosted: Wed Jul 16, 2008 3:11 pm    Post subject: Reply with quote

Hey, I have a angle for you I will test... why don't you show me mods for abnormally expanding padding, to assume a 9216 bit OS (64 x 144). That is rad., but would prove if my 64 bit XP & Vista accepts it, then no future issue Very Happy .... !
Back to top
ACoder
Guest





PostPosted: Wed Jul 16, 2008 3:12 pm    Post subject: Reply with quote

I was going to say, just for good countermesaure, maybe illustrate a 128bit and 256bit (normal), or even 512bit and maybe that hyper model Smile
Back to top
ACoder-not logged in
Guest





PostPosted: Sun Jul 27, 2008 3:04 am    Post subject: Reply with quote

Sean, was my large bit request to test too out of the ordinary? Cool
Back to top
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Sun Jul 27, 2008 3:38 am    Post subject: Reply with quote

ACoder-not logged in wrote:
Sean, was my large bit request to test too out of the ordinary? Cool

So, the script actually worked in 64bit Windows? Great, that's all I needed to know.

PS. If you get 128bit etc systems, come again. I'll tell you how then.
Back to top
View user's profile Send private message
hellhound
Guest





PostPosted: Sat Apr 25, 2009 7:20 pm    Post subject: Reply with quote

Hey I was just wondering if anyone can help me and explain how to move systray icons with this script.

Any help would be much appreciated.
Back to top
woschaible



Joined: 02 Jun 2009
Posts: 2

PostPosted: Thu Jun 04, 2009 3:31 pm    Post subject: Only Reading a special TrayIcon Reply with quote

I want to read out the "Status" of a certain TrayIcon (for instance for avgtn.exe - AntivirGuard). So I filled in the Script of Sean:
TrayIcons(sExeName = "avgnt.exe") as recommended.

Also Ilooked for the nfo's in which there are changes when Changing the try-Icon by clicking with the mouse. ( "inaktiv" and "aktiv")...

My questions are:

Is it neccessary to get all of the tray icons with the function"GetTrayBar(0)" or is there a possibility to reduce the script?

Are all of the dllCalls necessary or can I kick out some of them? Or: What do the different dll-Calls do?

Is the loop still neccessary, when only one exe-file is the aked one?

I've experimented with the script and found out, that only a few volumes are changing when I change the status of the relevant Icon (by Right Mousclick...)

Here is my Reduced code of your TrayIcon.ahk (within the demand if you could reduce it a little bit more..):

---------------------------------------------------------------------
MsgBox % TrayIcons()
Return


TrayIcons(sExeName = "avgnt.exe")
{
WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd
hProc:= DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
pProc:= DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 32, "Uint", 0x1000, "Uint", 0x4)
idxTB:= GetTrayBar()
SendMessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_BUTTONCOUNT
Loop, %ErrorLevel%
{
SendMessage, 0x417, A_Index-1, pProc, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd ; TB_GETBUTTON
VarSetCapacity(btn,32,0), VarSetCapacity(nfo,32,0)
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pProc, "Uint", &btn, "Uint", 32, "Uint", 0)
idn := NumGet(btn, 4)
If dwData := NumGet(btn,12)
iString := NumGet(btn,16)
Else dwData := NumGet(btn,16,"int64"), iString:=NumGet(btn,24,"int64")
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "Uint", &nfo, "Uint", 32, "Uint", 0)
If NumGet(btn,12)
hWnd := NumGet(nfo, 0)
, Var1 := NumGet(nfo,21)
, Var2 := NumGet(nfo,22)
, hIcon := NumGet(nfo,20)
Else hWnd := NumGet(nfo, 0,"int64"), uID:=NumGet(nfo, Cool, nMsg:=NumGet(nfo,12)
WinGet, pid, PID, ahk_id %hWnd%
WinGet, sProcess, ProcessName, ahk_id %hWnd%

If !sExeName || (sExeName = sProcess) || (sExeName = pid)
VarSetCapacity(sTooltip,128), VarSetCapacity(wTooltip,128*2)
, DllCall("ReadProcessMemory", "Uint", hProc, "Uint", iString, "Uint", &wTooltip, "Uint", 128*2, "Uint", 0)
, DllCall("WideCharToMultiByte", "Uint", 0, "Uint", 0, "str", wTooltip, "int", -1, "str", sTooltip, "int", 128, "Uint", 0, "Uint", 0)
, sTrayIcons .= "hIcon: " . hIcon . " | Var1: " . Var1 . " | Var2: " . Var2 . " | Process: " . sProcess . "`n" . " | Tooltip: " . sTooltip . "`n"
}

Return sTrayIcons
}


GetTrayBar()
{
ControlGet, hParent, hWnd,, TrayNotifyWnd1 , ahk_class Shell_TrayWnd
ControlGet, hChild , hWnd,, ToolbarWindow321, ahk_id %hParent%
Loop
{
ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
If Not hWnd
Break
Else If hWnd = %hChild%
{
idxTB := A_Index
Break
}
}
Return idxTB
}

__________________________________

thanks
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Fri Jun 05, 2009 2:39 am    Post subject: Reply with quote

woschaible wrote:
Is the loop still neccessary, when only one exe-file is the aked one?
I'd like to ask why you bother about that. Anyway, all are necessary. One thing you may alter is that currently the loop isn't stopped when an instance is found. It's for multiple instances of the same app and/or an app with multiple trayicons. If your app is running with only single instance and single trayicon, you may break out the loop as soon as found.
Back to top
View user's profile Send private message
woschaible



Joined: 02 Jun 2009
Posts: 2

PostPosted: Sun Jun 07, 2009 3:03 pm    Post subject: Reply with quote

Sean wrote:
woschaible wrote:
Is the loop still neccessary, when only one exe-file is the aked one?
I'd like to ask why you bother about that. Anyway, all are necessary. One thing you may alter is that currently the loop isn't stopped when an instance is found. It's for multiple instances of the same app and/or an app with multiple trayicons. If your app is running with only single instance and single trayicon, you may break out the loop as soon as found.


OK, thanks for your answer. I don't understand all of the file as I'm a beginner in programming with scripts which are getting information from dll's windows and so on. The hope was to reduce a little more and then I would understand a little more.... But you are right: I've founded a solution and its uneccessary to waste time.
Back to top
View user's profile Send private message
hardcider09



Joined: 26 Mar 2009
Posts: 15

PostPosted: Mon Jun 15, 2009 12:15 am    Post subject: Reply with quote

Hi, I'm a newbie trying to write a script that, at a certain point, will click on an icon in the notification tray of the taskbar.

Someone said I could use TrayIcon.ahk to do that but I'm lost.

When I run TrayIcon.ahk, I get a window that pops up that I think is telling me a bunch of information about the icons currently loaded in the tray.

My problem is, I have no idea how to use that info to put some command in my script that will click on the particular icon.

Any help is greatly appreciated. Smile
Back to top
View user's profile Send private message
hardcider09



Joined: 26 Mar 2009
Posts: 15

PostPosted: Mon Jun 15, 2009 12:37 am    Post subject: Reply with quote

I think I figured it out. I didn't want to waste anybody's time. I will write back if I run into any problems. Thanks! Very Happy
Back to top
View user's profile Send private message
wintersm



Joined: 06 Feb 2007
Posts: 12
Location: Zip: 80916

PostPosted: Tue Jun 30, 2009 9:51 pm    Post subject: Add Menu Item to external Application Tray Icon Reply with quote

I have written a little extension to Windows Instant Messenger to record the conversation on window close (save to file). It's not well written, but it works. I would like to add menu items to the Windows IM tray icon menu rather than add a whole new tray icon. These menu items could possibly be a "suspend script" action, or close script, or "save conversation", etc.

Is it possible to manipulate the tray icon menus of external programs?

An extension to this question would be, is it possible to save the window data to a file in rich text format? I tried GetClipboardData with no luck.

Thanks in advance for any help . . .

-Mike
_________________
-MRW
Back to top
View user's profile Send private message Send e-mail
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Tue Jun 30, 2009 10:51 pm    Post subject: Reply with quote

wintersm wrote:
Is it possible to manipulate the tray icon menus of external programs?
Basically, no.
Back to top
View user's profile Send private message
wintersm



Joined: 06 Feb 2007
Posts: 12
Location: Zip: 80916

PostPosted: Tue Jun 30, 2009 10:59 pm    Post subject: Reply with quote

Sean,

Can you elaborate on this? I have absolutely no idea how to write a dll.

How would the logic work? If I right click on the specific tray icon, show the following menu?
_________________
-MRW
Back to top
View user's profile Send private message Send e-mail
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Tue Jun 30, 2009 11:33 pm    Post subject: Reply with quote

wintersm wrote:
Can you elaborate on this? I have absolutely no idea how to write a dll.
Well, I removed the line immediately, however, you seemed to read it. My comment was about the context menus which does not apply to tray menus. Anyway, there exist at least two possible ways to do it. Subclassing which doesn't necessarily require a dll, or Hooking which does require a dll. That's all I'd like to say.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 5 of 9

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group