AutoHotkey Community

It is currently May 26th, 2012, 9:07 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 139 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 10  Next
Author Message
 Post subject:
PostPosted: February 6th, 2008, 6:24 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
i came to know about this script from here but i'd like how to single out a particular app and use hot-key to toggle show/hide the tray icon? i tried "Process, Exist" but not sure how to get it to return the idn.

also, will the idn be consistent throughout the session?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2008, 7:43 am 
Use it after replacing app.exe with the name of your app.
Code:
^t::RegExMatch(TrayIcons("app.exe"), "(?<=idn: )\d+", idn), HideTrayIcon(idn, bHide:=!bHide)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 11:18 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
Anonymous wrote:
Use it after replacing app.exe with the name of your app.
Code:
^t::RegExMatch(TrayIcons("app.exe"), "(?<=idn: )\d+", idn), HideTrayIcon(idn, bHide:=!bHide)

thanks for the above code but somehow it only works for visible icons but not for those already hidden by WinXP. is it possible to detect the icon's status and toggle the hidden status before applying this AHK hide method?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 4:23 pm 
badmojo wrote:
is it possible to detect the icon's status and toggle the hidden status before applying this AHK hide method?

The variable Statyle contains that information, TBSTATE_HIDDEN (=8).


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 13th, 2008, 4:34 pm 
After replacing inside TrayIcons() function
Code:
" | idn: " . idn
with
Code:
" | idn: " . idn . " | Statyle: " . Statyle

you can use
Code:
^t::RegExMatch(TrayIcons("app.exe"), "idn: (?<idn>\d+).*?Statyle: (?<Statyle>\d+)", TB_), HideTrayIcon(TB_idn, !(TB_Statyle&8))


Report this post
Top
  
Reply with quote  
 Post subject: [b][/b]
PostPosted: February 14th, 2008, 3:42 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
thanks again, Mr. Guest. ;) but i'm confused by the variable "Statyle", is it actually "State" or "Style"?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 14th, 2008, 5:54 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
It is, as the name implies, a combination of state and style.

Instead of
Code:
Statyle := NumGet(btn, 8)
;...
" | idn: " . idn . " | Statyle: " . Statyle
it would be more logical to use
Code:
State := NumGet(btn, 8, "uchar")
Style := NumGet(btn, 9, "uchar")
;...
" | idn: " . idn . " | State: " . State . " | Style: " . Style
(or just state if you don't need style.)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 11th, 2008, 6:15 pm 
I just played around with this nice script,
and it didn´t work on my german Win2000 System.
I had to modify the GetTrayBar-Function to get it to work:
Code:
GetTrayBar()
{
   WinGet, ControlList, ControlList, ahk_class Shell_TrayWnd
   RegExMatch(ControlList, "(?<=ToolbarWindow32)\d+(?!.*ToolbarWindow32)", nTB)
   Loop, %nTB%
   {
      ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
      hParent := DllCall("GetParent", "Uint", hWnd)
      WinGetClass, sClass, ahk_id %hParent%
      If ((sClass <> "SysPager") and (sClass <> "TrayNotifyWnd"))
         Continue
      idxTB := A_Index
         Break
   }

   Return   idxTB
}


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 12th, 2008, 12:20 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Z Gecko wrote:
I just played around with this nice script,
and it didn´t work on my german Win2000 System.
I had to modify the GetTrayBar-Function to get it to work:

That's too bad. I rewrote the function using IsChild API and uploaded the new one. You may try it. One thing though: it's based on the assumption that TrayNotifyWnd has only one child ToolbarWindow32.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 12th, 2008, 12:36 am 
Cool,
your new version works fine for me! 8)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: June 12th, 2008, 1:20 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
Z Gecko wrote:
Cool, your new version works fine for me! 8)

Good. BTW, the current GetTrayBar() may the slowest one among possible methods, so if you ever experience a performance problem, please let me know.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 13th, 2008, 10:38 pm 
Can someone please show me how to use the RemoveTrayIcon command?

I think I am doing it almost right, but it doesn't work....

For the program I want to use this on, I am first using this to ascertain the hWnd on the program class, which works,

Code:
WinGet, hWnd,, %insert_ahk_Class%


I am getting a hWnd var back, like a 0x183839, so it seems to find the program...

but, running this command next, doesn't seem to do anything.

Code:
RemoveTrayIcon(hWnd,0,0,0,2)


What could I be missing here? I am not sure about the syntax above :( If anyone could help point me in right direction it would be greatly appreciated! Thanks!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 12:54 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
ACoder wrote:
Code:
RemoveTrayIcon(hWnd,0,0,0,2)
You need to specify uID too. The correct syntax is
Code:
RemoveTrayIcon(hWnd, uID)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2008, 8:41 pm 
Ah, ok :oops:

Sorry Sean, I am still learning about the various identifiers for applications, .... can you clear me up?

The UID (Unique ID).... is this something I can set for a application I am running? so if I run a

run, myprogram.exe

is there some additional part to the run command which sets a UID? or no? how do i find out the UID for the program i have in mind? :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2008, 12:08 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
ACoder wrote:
how do i find out the UID for the program i have in mind? :)
You can obtain uID of your application's trayicon using the following. Probably you need to run it only once as uID is pretty constant with many apps.
Code:
MsgBox % TrayIcons("myprogram.exe")


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 139 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6 ... 10  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Klark92, Stigg, Yahoo [Bot] and 21 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