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 

An quick example using the updated Menu

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Tue Jul 06, 2004 4:24 pm    Post subject: An quick example using the updated Menu Reply with quote

I'm sitting here at work, bored out of my mind with nothing to do, so I decided to play with the new updated Menu stuff. Here's a quick example of how to make a middle-click-over-desktop popup menu. Nothing special, but hey, it's something to play with.

Code:

Menu, Popup, Add, Browser
Menu, Popup, Add, Console
Menu, Popup, Add, Documents
Menu, Popup, Add, Prism

MButton::
MouseGetPos, x, y, win
WinGetClass, class, ahk_id %win%
IfEqual, class, Progman
{
   Menu, Popup, Show
}
Else
{
   MouseClick, Middle
}
return

#X::Menu, Popup, Show

Browser:
Run iexplore
return

Console:
Run C:\docume~1\alleke01\mydocu~1\console\console.exe
return

Documents:
Run explorer C:\docume~1\alleke01\mydocu~1
return

Prism:
Run C:\docume~1\alluse~1\desktop\PRISM.lnk
return


Remember that you can press the first letter of a menu entry to run it, so I've got a bit of the emacs keychain stuff I've been wanting. Win+X B runs internet explorer and the like. By chaining menus together, you could make longer commands like that. More on this later.

Heck, this would better than emacs keychains because you woldn't need modifier keys, just normal keystrokes, and you'd also see what your options are. Hmmmmm.
Back to top
View user's profile Send private message AIM Address
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Tue Jul 06, 2004 4:41 pm    Post subject: Reply with quote

Here's a little longer one with a submenu. To illustrate what I was talking about with keychains, you could now press Win+X F C to get my computer. I don't know if anyone is interested in this sort of behavior, but I think it's useful if you've got a lot of stuff you want available from the keyboard without using up all your more conventional hotkeys.

Code:

Menu, Folders, Add, Documents
Menu, Folders, Add, Computer
Menu, Folders, Add, Control Panel, Panel
Menu, Folders, Add, Recycle Bin, Bin

Menu, Popup, Add, Browser
Menu, Popup, Add, Console
Menu, Popup, Add, Folders, :Folders
Menu, Popup, Add, Prism


MButton::
MouseGetPos, x, y, win
WinGetClass, class, ahk_id %win%
IfEqual, class, Progman
{
   Menu, Popup, Show
}
Else
{
   MouseClick, Middle
}
return

#X::Menu, Popup, Show


Browser:
Run iexplore
return

Console:
Run C:\docume~1\alleke01\mydocu~1\console\console.exe
return

Prism:
Run C:\docume~1\alluse~1\desktop\PRISM.lnk
return

Documents:
Run explorer C:\docume~1\alleke01\mydocu~1
return

Computer:
Run, C:\docume~1\alleke01\mydocu~1\shortcuts\mycompu~1.lnk
return

Bin:
Run, C:\docume~1\alleke01\mydocu~1\shortcuts\recycl~1.lnk
return

Panel:
Run, C:\docume~1\alleke01\mydocu~1\shortcuts\contro~1.lnk
return


Two things though. First, there has GOT to be a better way to open up system folders (my computer, etc) than using shortcuts like I am. Does anyone know it? Second, pardon my dos notation for filenames. Force of habit Wink, though I think it's simpler than worrying about quotes and such.
Back to top
View user's profile Send private message AIM Address
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10463

PostPosted: Tue Jul 06, 2004 11:15 pm    Post subject: Reply with quote

Quote:
Remember that you can press the first letter of a menu entry to run it

Also, if it helps you can also put an ampersand in front of any letter in the menu name to make its shortcut key some other letter. e.g. "Run &Notepad" would make N the shortcut key rather than R.

Quote:
pardon my dos notation for filenames. Force of habit , though I think it's simpler than worrying about quotes and such.

In case you don't know, you don't need double quotes around file names when using the Run command, nor around the working directory, even if they contain spaces.

Quote:
there has GOT to be a better way to open up system folders (my computer, etc) than using shortcuts

I googled these methods:
; Opens My Computer in double pane view:
run explorer.exe /e`,/select`,c:\
; Opens simple folder view:
run explorer.exe /select`,c:\
; Opens Control Panel:
run rundll32.exe shell32.dll`,Control_RunDLL

In addition, I've made a change that allows literal double colons to appear in a command by escaping them, which will allow CLSID's to be used with Explorer.exe in the next release. Example: run explorer.exe /n`,`::{20D04FE0-3AEA-1069-A2D8-08002B30309D}. You can google more info about the various CLSIDs.
Back to top
View user's profile Send private message Send e-mail
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Wed Jul 07, 2004 10:58 pm    Post subject: Reply with quote

Aargh, I completely forgot about rundll32 stuff, I think I've done that before. Embarassed

I know that I don't need to worry about spaces but, like I said, it's just a habit I've gotten into. It's shorter to type and read as well. Wink
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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