 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ahk_man
Joined: 20 Jun 2004 Posts: 39
|
Posted: Thu Jul 29, 2004 5:07 am Post subject: Menu |
|
|
| 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 |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Thu Jul 29, 2004 12:16 pm Post subject: |
|
|
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 |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Thu Jul 29, 2004 1:11 pm Post subject: |
|
|
| 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 |
|
 |
ahk_man
Joined: 20 Jun 2004 Posts: 39
|
Posted: Fri Jul 30, 2004 6:09 am Post subject: Thanks |
|
|
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 |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri Jul 30, 2004 5:23 pm Post subject: Re: Thanks |
|
|
| 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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|