Page 1 of 1

cm_Null - Null command, always inactive

Posted: 2013-02-25, 00:57 UTC
by LonerD
When creating your own main menu commands are grouped similar purpose. For example, - opening a file, copying a variety of ways, archiving, administration, multimedia etc.
I would like to make comments in the menu for these groups.
For now I use this command 555 - cm_FtpResumeDownload. It displays the inactive (blocked) menu item. But if connected FTP, - then menu are active and can be accidentally pressed.

Request to add new command that would do nothing and always displayed on the main menu as inactive.

Posted: 2013-02-25, 11:34 UTC
by petermad
Support++

As a workaround you can make a userdefined command like:

[em_comment]
cmd=cd

This can be used in the Menu for comments, but it will not be shown as inactive. If you accidently click on a line with that command, nothing happens, but you don't get an error message.

Posted: 2013-02-25, 18:12 UTC
by Balderstrom
You can also put in a fake cm_, such as "cm_"
It will be disabled, but it will also announce (every instance of) the error via a pop-up when the MainMenu/Language is loaded.

To handle the pop-up - you could use something like this:

Code: Select all

return
#ifWinActive ahk_class #32770
!Enter::SetTimer, TCLanguageUnknownID, 50
#ifWinActive


TCLanguageUnknownID:
	ControlGetText, unknown, Static2, ahk_class #32770
	if(RegExMatch(unknown, "^Unknown identifier in line (\d+) of menu file:.cm_", rTmp))
		ControlClick, Button1, ahk_class #32770
	else
		SetTimer, TCLanguageUnknownID, OFF
	WinWaitActive, ahk_class #32770,,1
return

Press Alt+Enter when the error comes up. Then all the error boxes will get "auto-clicked" until there are no more.


Neither solution is particularly convenient or elegant - but they'll work until we can be allowed to use cm_Null or cm_MenuItemDisabled.

Posted: 2013-03-01, 10:49 UTC
by MVV
BTW information menu items may be used to display detailed message box with hint. :) You just need to create corresponding EM-command.

Posted: 2015-04-28, 00:30 UTC
by LonerD
2 year UP

Posted: 2016-06-09, 13:32 UTC
by LonerD
Hope it will be added in TC9

Posted: 2016-06-10, 19:34 UTC
by ghisler(Author)
You can use
CM_WAIT 0
on a button (doesn't work in command line).

Posted: 2016-06-10, 22:15 UTC
by LonerD
ghisler(Author) wrote:You can use
CM_WAIT 0
on a button (doesn't work in command line).
Oh. Thanks.
Added: The following commands now accept a numeric parameter in the button bar or start menu: CM_WAIT ...
But I try to add string to main menu:

Code: Select all

MENUITEM "Commentary", CM_WAIT 0
and Total can't start.

Posted: 2016-06-12, 15:39 UTC
by ghisler(Author)
Since it's a command with parameter, you need to put it inside a user command em_something.

Posted: 2016-06-13, 12:34 UTC
by LonerD
ghisler(Author) wrote:Since it's a command with parameter, you need to put it inside a user command em_something.
But em command are alwaws active in main menu.
It would be great to make inactive command (always grey without possibility to press it) for commentaries or titles.

Posted: 2016-06-13, 13:01 UTC
by Lefteous
2LonerD
The normal way to group menu items would be to put them between two menu separators. If it's a main group consider creating a top level menu item.
Creating inactive menu items sounds quite unusual for me.

Posted: 2016-06-15, 23:58 UTC
by LonerD
Lefteous wrote:The normal way ...
Creating inactive menu items sounds quite unusual for me.
With 2-3 thousand commands in menu any ways are good.

Posted: 2016-07-17, 17:24 UTC
by Balderstrom
Lefteous wrote:2LonerD
The normal way to group menu items would be to put them between two menu separators. If it's a main group consider creating a top level menu item.
Creating inactive menu items sounds quite unusual for me.
Off the top of my head, Inactive Menu Items can be used for:
1) TITLE/separator for commands underneath.
2) A Menu list of Keyboard shortcuts.

I've used "cm_return" as the command target for #2, but its quite hacky.