AutoHotkey Community

It is currently May 25th, 2012, 10:02 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: [module] Tray 2.1
PostPosted: November 28th, 2007, 4:07 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade

_________________
Image


Last edited by majkinetor on September 11th, 2009, 9:28 am, edited 6 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2007, 5:16 pm 
Offline

Joined: July 20th, 2007, 10:23 am
Posts: 257
Location: Paris, France
Great :D Thank you very much.
It's good to know that we are not limited with the number of tray icons anymore.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 28th, 2007, 11:22 pm 
Offline

Joined: July 16th, 2005, 11:39 am
Posts: 96
I will find this useful. Thanks. Looks pretty easy to use. :D

_________________
“yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2007, 10:51 pm 
Offline

Joined: July 11th, 2005, 10:13 pm
Posts: 108
Location: Germany
this piece of soft is very interesting!

@majkinetor:
is there a way to attach different menus to the tray icons?
with your test script every created icon shares the same menu.

i tried different things but wasn't able to do it the right way(tm).

regards...
Junyx

_________________
C.R.E.A.M.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 29th, 2007, 11:50 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
Yes, something like:

Code:
hIcon1 := Tray_Add(...)
hIcon2 := Tray_Add(...)

OnTrayIcon(wparam, lparam) {
   local msg
   static LBUTTONDOWN=0x201, LBUTTONUP=0x202, LBUTTONDBLCLK=203, RBUTTONDOWN=0x204, ....
   msg := lparam & 0xFFFF

   if (msg != RBUTTONUP)
      return

   if (wparam = hIcon1)
         ShowMenu(menu1)

   if (wparam = hIcon2)
         ShowMenu(menu2)
}

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2007, 2:45 pm 
Offline

Joined: July 11th, 2005, 10:13 pm
Posts: 108
Location: Germany
thanks, man!
will try it on weekend.
i thought my "solution" looked similar but didn't work out as expected...

_________________
C.R.E.A.M.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2007, 1:31 pm 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
interesting.

glanced at code but did not see, is there a reason is placing only lo-res version of icons ?

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2007, 2:18 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
LOL... well, there is a reason.
I am totaly bored by that topic (icons in the menus) and didn't find the way back then (while developing MMenu) to 1) load shell icons in any other size then 32 or 16, 2) make them hi res.

I beleive lexikos answered both of those questions, so perhaps we can summon him here for help instead of taking it hard way and browsing his Menu function.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 3rd, 2007, 7:02 pm 
Offline

Joined: July 11th, 2005, 10:13 pm
Posts: 108
Location: Germany
majkinetor wrote:
Code:
hIcon1 := Tray_Add(...)
hIcon2 := Tray_Add(...)
OnTrayIcon(wparam, lparam) {
   local msg
   static LBUTTONDOWN=0x201, LBUTTONUP=0x202, LBUTTONDBLCLK=203, RBUTTONDOWN=0x204, ....
   msg := lparam & 0xFFFF
   if (msg != RBUTTONUP)
      return
   if (wparam = hIcon1)
         ShowMenu(menu1)
   if (wparam = hIcon2)
         ShowMenu(menu2)
}

i tried the code (merged it with your _Test.ahk) - but i won't work.
menu2 will be displayed, but not only for tray icon no. 2.
instead both tray menus will be set to menu2.

did you try your code yourself?

_________________
C.R.E.A.M.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 4th, 2007, 12:12 am 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
you didn't do something correctly.

This example works:

Code:
#NoTrayIcon
#SingleInstance force

   Gui,  +LastFound
   hwnd := WinExist()

   menus =
   (LTrim
         [TrayMenu1]
         11
         12

         [TrayMenu2]
         21
         22
         23
   )

   h1 := Tray_Add( hwnd, "OnTrayIcon", "res\new.ico")
   h2 := Tray_Add( hwnd, "OnTrayIcon", "res\new.ico")
return

TrayMenu1:
   msgbox Hi from menu1
return

TrayMenu2:
   msgbox Hi from menu2
return

OnTrayIcon(wparam, lparam) {
   local msg
   static LBUTTONDOWN=0x201, LBUTTONUP=0x202, LBUTTONDBLCLK=203, RBUTTONDOWN=0x204, RBUTTONUP=0x205, RBUTTONDBLCLK=0x206, MBUTTONDOWN=0x207, MBUTTONUP=0x208, MBUTTONDBLCLK=0x209
   msg := lparam & 0xFFFF

   if (msg != RBUTTONUP)
      return


   if (wparam=h1)
       ShowMenu(menus, "TrayMenu1")
   else ShowMenu(menus, "TrayMenu2")
}

#include Tray.ahk
#include res\ShowMenu.ahk

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: December 5th, 2007, 8:29 pm 
Offline

Joined: July 11th, 2005, 10:13 pm
Posts: 108
Location: Germany
okay, thanks. your last code worked for me.

Junyx

_________________
C.R.E.A.M.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2008, 3:30 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
v1.0
http://www.autohotkey.net/~majkinetor/Tray/Tray.html


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 12th, 2009, 10:30 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
v2.0a

- All globals removed.
- Module can now examine and modify 3thd pardy icons. See about for more information about the code.
- Add function now accepts icon resources.
- Several other APIs added.
- New samples.
- Docs updated.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2009, 7:29 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
* v2.1 *
+ Tray_Click - you can now send click to any tray icon (even hidden ones) and generally totally automate tray area
+ Tray_Disable -allows you to totally disable notification area.
+ Tray_Focus - allows you to focus tray icon or tray area. You can then use keyboard to launch menus or move around.
+ Tray_Rect - get coordiantes of the icon, screen or relative.
+ Sample updated - clicking on icon will now send click to icon, use shift left click to dbl left click the icon.

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 10th, 2009, 8:11 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
This is small example of how to select particular item from the menu of 3td party tray icon.

Program CCC.exe holds ATI video driver tray menu. I am selecting second item of the first submenu with the following code:

Code:
   
   BlockInput, on
   pos := Tray_Define("CCC.exe", "i")
   Tray_Click(pos, "R")
   WinWait, ahk_class #32768
;   WinHide, ahk_class #32768            ;this and next line are to hide the menu.
;   WinKill, ahk_class SysShadow
   ControlSend,,{Down}{Down}{Right}{Down}{ENTER},ahk_class #32768
   BlockInput, off
   ExitApp


This code is very reliable because it doesn't depend on Taskbar settings (if its hidden, on non-default position, disabled, etc...) and notification area settings (for instance, if icon is moved to the hidden icons)

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: tidbit and 7 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