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 

Menu

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ahk_man



Joined: 20 Jun 2004
Posts: 39

PostPosted: Thu Jul 29, 2004 5:07 am    Post subject: Menu Reply with quote

If you right click anywhere on the Windows desktop, you will have a popup showing a few default menu and submenu. For example, you might see a properties, open, printto, ...etc. My question is: How can I get rid of all those default menu and submenu and create my own menu and submenu? I want to create a icon and place it on the windows desktop. When I right click this desktop, it should shows my personalize menu, and each menu is associate with an action that I will assign to it. For example, I will have a menu call "Internet Explorer" and this will launch the Microsoft IE.
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Thu Jul 29, 2004 12:16 pm    Post subject: Reply with quote

make rt. click a pass through hotkey (~) and use a check to see if the active window is "Program Manager" then show the menu. this should do it.
_________________
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Thu Jul 29, 2004 1:11 pm    Post subject: Reply with quote

Quote:
make rt. click a pass through hotkey (~) and use a check to see if the active window is "Program Manager" then show the menu. this should do it.

That's a good idea. At first, I tried that but had trouble with dismissing the default menu because sometimes it appears on mouse-down, and sometimes on mouse-up. Therefore, I tried another approach.

Quote:
How can I get rid of all those default menu and submenu and create my own menu and submenu?

It's good that you mentioned this because there was an older topic that can benefit too. Here is a working example script for Windows XP (and probably 2k/NT). You can't use it on Win9x since there is no support for mouse hotkeys.
Code:
Menu, MySubmenu, Add, SubItem1, MenuHandler
Menu, MySubmenu, Add, SubItem2, MenuHandler
Menu, MyMenu, Add, Item1, MenuHandler
Menu, MyMenu, Add, Item2, MenuHandler
Menu, MyMenu, Add  ; Separator line.
Menu, MyMenu, Add, My Submenu, :MySubmenu
Menu, MyMenu, Add, Launch Browser, LaunchBrowser
return

RButton::
MouseGetPos, , , WindowUnderMouse
WinGetClass, ClassUnderMouse, ahk_id %WindowUnderMouse%
if ClassUnderMouse <> WorkerW
{
   if ClassUnderMouse <> Progman  ; No desktop, so make RButton behave normally.
   {
      MouseClick, right, , , , , D
      Loop
      {
         Sleep, 10
         GetKeyState, RButtonState, RButton, P
         if RButtonState = U  ; button has been released
            break
      }
      MouseClick, right, , , , , U
      return
   }
}
; Otherwise, the user has clicked on the desktop, so do a custom action.
Menu, MyMenu, Show
return

MenuHandler:
MsgBox You selected %A_ThisMenuItem% from menu %A_ThisMenu%.
return

LaunchBrowser:
Run, http://www.google.com
return

Edit: fixed tabbing of code.


Last edited by Chris on Fri Jul 30, 2004 12:00 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
ahk_man



Joined: 20 Jun 2004
Posts: 39

PostPosted: Fri Jul 30, 2004 6:09 am    Post subject: Thanks Reply with quote

Hi Chris,
Thank you so much for the workable script. It is exactly what I wanted to accomplish. Rajat, thanks for the reply (When will we see more cool script from you again?).
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Fri Jul 30, 2004 5:23 pm    Post subject: Re: Thanks Reply with quote

ahk_man wrote:
(When will we see more cool script from you again?).


i've posted one yesterday, which i use regularly. in fact this once i've waited for about a month before submitting it, used it regularly before posting it, ironing out bugs and adding code.
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
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