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 Additions

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
compuboy_r



Joined: 04 May 2004
Posts: 68

PostPosted: Sun Sep 05, 2004 10:03 am    Post subject: Menu Additions Reply with quote

How about having commands

1. Hiding Menu

Menu,Hide,MenuName


2. Getting Menu Path on Execution

%A_ThisMenuItemPath%
that gives the whole path

MyMenu\MySubMenu\MySubSubMenu\MySubSubSubMenuItem


3. Whenever a menu is displayed the script pauses to function. Any way to make the other threads continue execution except that is showing menu or Another Command

Menu,WaitHide,MenuName


compuboy_r
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Sep 05, 2004 1:59 pm    Post subject: Reply with quote

Quote:
1. Hiding Menu
Menu,Hide,MenuName
Do you mean removing it from a menu bar? You could just delete the submenu item (not the submenu itself), which effectively hides that menu on the menu bar. You can also use Menu, MenuName, MySubmenu, ToggleEnable to "gray out" an entire submenu. But now I see that you're probably referring to the inability to later re-insert a menu item between two other menu items. If so, I can see why hiding would be a good feature to have.

Quote:
2. Getting Menu Path on Execution
%A_ThisMenuItemPath%
that gives the whole path
MyMenu\MySubMenu\MySubSubMenu\MySubSubSubMenuItem
If you didn't already know, A_ThisMenu contains the name of the menu itself, which must be unique. In other words, A_ThisMenu does not contain the item name the submenu was given when attached to some other menu. Given this, it seems this feature would be too rarely needed to be justified? Maybe you could give an example of what it would be used for (e.g. having the same submenu attached in multiple places, but wanting its items to perform a different action depending on where the submenu is).

Quote:
Whenever a menu is displayed the script pauses to function. Any way to make the other threads continue execution except that is showing menu or Another Command
Nice idea. I tried this once but it caused reliability problems with the menu being navigated by the user. I think this is because AutoHotkey uses only one true thread, and if that thread is away executing some other part of the script, it can't properly monitor what the user is doing with the menu, so the menu sometimes becomes sluggish or it might even "miss" something the user clicked on.

Still, if you could give an example of some problem such a feature would help solve, or some feature it would make possible, I'd like to hear it.
Back to top
View user's profile Send private message Send e-mail
compuboy_r



Joined: 04 May 2004
Posts: 68

PostPosted: Sun Sep 05, 2004 7:12 pm    Post subject: Reply with quote

Quote:
Quote:
1. Hiding Menu
Menu,Hide,MenuName
Do you mean removing it from a menu bar? You could just delete the submenu item (not the submenu itself), which effectively hides that menu on the menu bar. You can also use Menu, MenuName, MySubmenu, ToggleEnable to "gray out" an entire submenu. But now I see that you're probably referring to the inability to later re-insert a menu item between two other menu items. If so, I can see why hiding would be a good feature to have.



No, No I did not mean to hide menu from a MenuBar.

I mean reverse of

Menu,Menuname,show

ie Menu,Menuname,hide

So that if i give command Menu,MyMenu,Show and the script continues as i have asked for so To hide it.

Quote:

Quote:
2. Getting Menu Path on Execution
%A_ThisMenuItemPath%
that gives the whole path
MyMenu\MySubMenu\MySubSubMenu\MySubSubSubMenuItem
If you didn't already know, A_ThisMenu contains the name of the menu itself, which must be unique. In other words, A_ThisMenu does not contain the item name the submenu was given when attached to some other menu. Given this, it seems this feature would be too rarely needed to be justified? Maybe you could give an example of what it would be used for (e.g. having the same submenu attached in multiple places, but wanting its items to perform a different action depending on where the submenu is).



See the script below and you would clearly get what i need.

Code:
Menu,SubSubSubMenu,add,SubSubSubSubItem,go
Menu,SubSubMenu,add,LabelSubSubSubMenu,:SubSubSubMenu
Menu,SubMenu,add,LabelSubSubMenu,:SubSubMenu
Menu,Menu,add,LabelSubMenu,:SubMenu
Menu,Menu,show



go:
MsgBox ,0,Menu,A_ThisMenu = %A_ThisMenu% `nA_ThisMenuItem = %A_ThisMenuItem% `n`nBut How can I get the name of all the menus (not the item name) ie SubSubMenu, SubMenu and Menu

Quote:

Quote:
Whenever a menu is displayed the script pauses to function. Any way to make the other threads continue execution except that is showing menu or Another Command
Nice idea. I tried this once but it caused reliability problems with the menu being navigated by the user. I think this is because AutoHotkey uses only one true thread, and if that thread is away executing some other part of the script, it can't properly monitor what the user is doing with the menu, so the menu sometimes becomes sluggish or it might even "miss" something the user clicked on.

Still, if you could give an example of some problem such a feature would help solve, or some feature it would make possible, I'd like to hear it.



Well, I asked all these because i was thinking to make a script generate a Directory Structure dynamically and run the file when user clicks it.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Sep 05, 2004 7:53 pm    Post subject: Reply with quote

Quote:
But How can I get the name of all the menus (not the item name) ie SubSubMenu, SubMenu and Menu
The way to do it is to track it yourself. In other words, at the time a submenu is attached to a parent menu, set a variable indicating the name of that submenu's parent.

The reason I'm reluctant to add a new variable is: 1) there's a relatively easy workaround (above); 2) it seems like it would be very rarely used.

Quote:
Well, I asked all these because i was thinking to make a script generate a Directory Structure dynamically and run the file when user clicks it.

Rather than having a really deep series of nested menus, perhaps you can adapt the following working example that was posted by Rajat a while back:
Code:
; Navigate through the directories until you find one you want to open.
; Shift-left-click it to open it.

home = c:
cancel? = n
Loop
{
   if cancel? = y
      break
   Folders =
   Menu, Foldermenu, add, [..], RunFolder

   Loop, %home%\*.*, 2
      Folders = %Folders%`n%A_LoopFileName%

   Sort, Folders

   Loop, parse, Folders, `n
      Menu, Foldermenu, add, %A_LoopField%, RunFolder

   an_item_was_selected? = n
   Menu, Foldermenu, show
   if an_item_was_selected? = n  ; Cancel the menu
      break

   IfEqual, A_ThisMenuItem, [..]
      SplitPath, Home, , Home
   else
   {
      GetKeyState, State, Shift
      IfEqual, State, D
      {
         Run, %home%\%A_ThisMenuItem%
         break
      }
      ; Otherwise, shift key is not down:
      home = %home%\%A_ThisMenuItem%
   }
   Menu, FolderMenu, DeleteAll
}
Exit


; To prevent new threads from being created, one for each time the user
; selects a folder, this intentionally does nothing to let the main
; loop handle it:
RunFolder:
an_item_was_selected? = y
return


Thanks for your suggestions. You've made the most extensive use of the Menu command out of just about anyone else I've seen post here.
Back to top
View user's profile Send private message Send e-mail
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Tue Jan 11, 2005 2:44 pm    Post subject: Me Too Reply with quote

I also found it natural to build a folder-menu using a similar self-refering menu, but have found it difficult. I could set up a matched variable-list, or multi-field variables but it all seemed too much overhead. P'raps I'm finding that's what it takes. But I searched the manual and had myself completely flustered -as one does- All the time completly convinced that I'd missed it somewhere... that elusive variable %a_ThisMenuPath%

My script is stuffed anyway 'cause it loops back into itself and gets lost so I'll have another look at DirMenu (which is pretty good) and see if I can get it to sort, and fit into my particular scheme.

Still %a_ThisMenuPath% would make things easier...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Jan 11, 2005 10:25 pm    Post subject: Reply with quote

There's tons of freeware out there that builds directory structures in a menu... it's almost sickening how many of these I run across. It's like antivirus software or text editors; everyone has a reason to build their own. If you want, I could build a list of my personal collection of them, all well developed and perfectly working. MenuApp's one, for starters. Panekiller's excellent too; exmenu by AM Productions is primitive, but still just fine. I could go on and on. I'm sure there's a reason for you making it in AHK, though. I looked into this once myself, actually. I came to the conclusion that there's no reason to reinvent the wheel if there's already great (and free Wink ) software out there to get the same job done.
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Tue Jan 11, 2005 10:36 pm    Post subject: Re: Me Too Reply with quote

bLisTeRinG wrote:
%a_ThisMenuPath% would make things easier...
When you create a menu, make its name the full path of the files it contains. That way, when a user selects a menu item, A_ThisMenu will contain the full path of the file's folder, which in turn means that %A_ThisMenu%\%A_ThisMenuItem% is the full path and name of the selected file.

If you discover some kind of menu system for which the above would be substantially inferior to A_ThisMenuPath, please explain the details. Such details may well justify adding A_ThisMenuPath as a new built-in variable.

Thanks.
Back to top
View user's profile Send private message Send e-mail
bLisTeRinG



Joined: 15 Nov 2004
Posts: 45
Location: Warrnambool

PostPosted: Sun Jan 16, 2005 2:38 pm    Post subject: Reply with quote

... tons of freeware out there?

Of course, Jonny's right. I must have at least a dozen menu/toolbars about the place. I've only kept the good ones but they're never quite right. So I keep coming back to it.

...full path of the files?

Chris is right too, I did that first, but the menus get sooo looong. I think I'm probably stuck in my roots when ram was so small every new variable was a compromise. I'm always ballooning out, then seeing what I can get rid of (till it falls over). But I really [i]could [/i]go back and use an extra variable to match the menu name.

By the way, someone - somewhere mentioned ShortPopUp. Now it's all over my machine, replacing perfectly good menus. I quite like it ... but ...
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sun Jan 16, 2005 5:32 pm    Post subject: Reply with quote

bLisTeRinG wrote:
I really could go back and use an extra variable to match the menu name.
I don't see why you'd need an extra variable. The built-in variables A_ThisMenu and A_ThisMenuItem would contain the complete path and name of every file in the menu.

Internally, it would still use more memory than a file-menuing system programmed from scratch. But at least it would be relatively easy to script.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List 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