AutoHotkey Community

It is currently May 27th, 2012, 1:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: June 27th, 2005, 11:46 am 
Offline

Joined: June 16th, 2005, 12:23 pm
Posts: 92
The docs left me with the distinct impression that the above line would make the &Help entry in the tray menu the default choice.

It doesn't. AHK just complains about a nonexistent menu item. What gives?

Thomas


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 12:28 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
Try:

Code:
Menu, TRAY, Default, Help


Without the ampersand. The ampersand is used to define the key-shortcut that can be used if the menu is selected, but is not part of the label/name.

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 1:02 pm 
Offline

Joined: June 16th, 2005, 12:23 pm
Posts: 92
Of course, I tried that before posting.

At any rate, the docs say clearly that the & is required:

Quote:
When referring to an existing menu or menu item, the name is not case sensitive but any ampersands must be included. For example: &Open


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 1:27 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
Hmm, ok my bad...

Can you post the code that causes this?

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 3:21 pm 
Offline

Joined: June 16th, 2005, 12:23 pm
Posts: 92
Quote:
post the code

What do you mean? The error message is caused by the one line which forms the subject of this thread. But if it helps, here it's once again:
Smile
Code:
Menu, tray, default, &Help

Nothing more, nothing less.

This is part of a much bigger setup but that shouln't be of any importance.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 3:46 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
I never used that command, but shouldn't it
Code:
Menu, tray, add default, &Help
*just a guess*

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 3:47 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
or maybe two lines
Code:
Menu, tray, add, &Help
Menu, tray, default, Help

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 3:58 pm 
Offline

Joined: June 16th, 2005, 12:23 pm
Posts: 92
&Help is a standard menu item for the tray, so I don't think so.

What you suggest works for menu items I add myself to the tray menu, I checked that, but not for the standard ones.

There are a zillion possible ways to try get that working but what the heck, if it doesn't work, so be it.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 4:07 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
Weird...

I took a portion of the code in the Help file:

Code:
#Persistent
#SingleInstance
menu, tray, add ; separator
menu, tray, add, &Help
menu, tray, default, &Help
return


And it gives me the following error (similar to yours):

Quote:
Error: Target label does not exist. The current thread will exit.

Specifically: &Help

Line#
003: Menu,tray,add
---> 004: Menu,tray,add,&Help
005: Menu,tray,default,&Help
006: Return
007: Exit
007: Exit


Doesn't matter which label/text I try to use... (with or without ampersands)

Very weird... Since, when I use the whole code from the Help file, it works... :(

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 4:16 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
What AHK wants is the label, add this to your code and it should work (I hope)
Code:
Help:
   MsgBox, Help is given
return

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 27th, 2005, 4:41 pm 
Offline

Joined: March 16th, 2005, 10:33 pm
Posts: 969
Location: Frisia
Duh... :?

Ok, very good... no bug (a feature :P )...

Code:
#Persistent
#SingleInstance
menu, tray, add ; separator
menu, tray, add, &Help
menu, tray, default, &Help
return

&Help:
msgbox, You selected Help
return

_________________
Image mirror 1mirror 2mirror 3ahk4.me • PM or Image


Report this post
Top
 Profile  
Reply with quote  
PostPosted: June 27th, 2005, 11:24 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
thomasl wrote:
Menu, tray, default, &Help
The standard menu items are not individually addressable. They use all-or-none behavior (such as NoStandard).

There were design reasons for this. I believe the primary one was that it would add considerable complexity to the code to make them individually addressable.

I will add more comments to the help file about this limitation.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 28th, 2005, 10:49 am 
Offline

Joined: June 16th, 2005, 12:23 pm
Posts: 92
Quote:
add more comments to the help file about this limitation

Yes, that would be helpful. Would've saved me a bit of groping in the dark :wink:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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