AutoHotkey Community

It is currently May 26th, 2012, 10:14 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: October 22nd, 2008, 4:26 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Here's what I currently use, which is an adaptation of this script, to control the SteamLab tray menu opening.

It can handle different actions for right and left clicking, and also a different action for double-clicking.

First, you set up the OnMessage event somewhere where it will run automatically:
Code:
OnMessage(0x404, "SteamLab_NotifyIcon")


Then, create the function to handle the event:
Code:
SteamLab_NotifyIcon(wParam, lParam) {
   static ignorenext
   if ignorenext {
      ignorenext := false
   } Else {
      If (lParam = 0x205) ;Right click menu
         SetTimer, RightClickTray, -1
      Else If (lParam = 0x202) { ; Left click menu
         ignorenext := true
         KeyWait, LButton, D T0.2
         If ErrorLevel
            SetTimer, LeftClickTray, -1
         Else SetTimer, OpenSteam, 50
      }
   }
   ;OnMessage(0x404, "SteamLab_NotifyIcon")
   Return 0
}

LeftClickTray:
RightClickTray:
   CoordMode, Mouse, Screen
   MouseGetPos, curMouseX, curMouseY
   MMenu_Show(TrayMenu, curMouseX, curMouseY, "TrayMenuClick", "ITrayMenuIsShowing UTrayMenuIsClosing")
Return

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2008, 10:36 am 
Offline

Joined: July 1st, 2008, 1:28 pm
Posts: 13
Hi bmcclure,

Thanks! Works super.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 23rd, 2008, 4:37 pm 
Offline

Joined: November 24th, 2007, 9:07 pm
Posts: 774
Great to hear! I think my function needs some refactoring (I haven't touched it in over a year I think), but overall it's worked quite well for me too.

If you are catching double-clicks, make sure to keep something similar to the 'ignorenext' static variable, otherwise it will launch two events.

If you're copying the function, though, it should be fine. Thanks!

_________________
Ben

My Trac projects
My Wiki
[Broken] - My music


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

All times are UTC [ DST ]


Who is online

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