
585
ADOBE FRAMEMAKER SCRIPTING GUIDE
Function Summary
Last updated 9/26/2011
If you call
DefineAndAddCommand()
and specify the name of a command that is already defined in the user’s menu
configuration files, FrameMaker gives precedence to the definition in the configuration files.
If the configuration files assign a label or a shortcut to the command, then FrameMaker uses it instead of the one you
specify.If the command is already a menu item, FrameMaker ignores the menu that you specify and leaves the menu
item where it is.
Note:
If you want to add a command to more than one menu, do not call DefineAndAddCommand() repeatedly to add
the command to the menus. To add a command to multiple menus, define the command first by calling
DefineCommand()—or call iDefineAndAddCommand(), if you want to define and add the command to a menu at the
same time—and then call AddCommandToMenu() to add the command to other menus.
The method returns the command, on success.
On failure, the method returns one of the following values to
FA_errno
:
Returns
Command
Syntax
DefineAndAddCommand(cmdNum, name, label, shortcut)
Parameters
Error
Reason
Constants.FE_WrongProduct (-60)
Current FrameMaker product does not support this operation or
fmbatch
is running.
Constants.FE_BadOperation (-27)
Parameters specified an invalid operation.
Constants.FE_NotMenu (-72)
The specified menu does not exist.
Constants.FE_BadParameter (-43)
The specified parameter has an invalid value.
Constants.FE_SystemError (-42)
System Error
Parameter name
Data Type
Optional
Description
cmdNum
number
No
The integer that the FrameMaker product passes to your client’s
Command()
function when the user chooses the menu item or
types the keyboard shortcut for the command.
The value must be unique for each command in your client, but
need not be unique for different clients.
name
string
No
A unique name for the command. If the user or a client has
already defined a command or menu with this name, the new
command replaces it.
label
string
No
The title of the command as it appears on the menu.
shortcut
string
No
The keyboard shortcut sequence. Many FrameMaker product
commands use shortcuts beginning with Escape (
\!
). To specify
Escape when you create a command, use
\\!
in the string you
pass to shortcut.