How commands work
When a user clicks a menu that contains a command, the following events occur:
- Adobe Dreamweaver calls the
canAcceptCommand()
function to determine whether the menu item should be disabled. If thecanAcceptCommand()
function returns afalse
value, the command is dimmed in the menu, and the procedure stops. If thecanAcceptCommand()
function returns atrue
value, the procedure can continue. - The user selects a command from the menu.
- Adobe Dreamweaver calls the
receiveArguments()
function, if defined, in the selected Command file to let the command process any arguments that pass from the menu item or from thedreamweaver.runCommand()
function. For more information on thedreamweaver.runCommand()
function, see the Adobe Dreamweaver API Reference. - Adobe Dreamweaver calls the
commandButtons()
function, if defined, to determine which buttons appear on the right side of the Options dialog box and what code should execute when the user clicks the buttons. - Adobe Dreamweaver scans the command file for a
FORM
tag. If a form exists, Adobe Dreamweaver calls thewindowDimensions()
function, which sizes the Options dialog box that contains theBODY
elements of the file. If thewindowDimensions()
function is not defined, Adobe Dreamweaver automatically sizes the dialog box. - If the command file's
BODY
tag contains anonLoad
handler, Adobe Dreamweaver executes it (whether or not a dialog box appears). If no dialog box appears, the remaining steps do not occur. - The user selects options for the command. Adobe Dreamweaver executes event handlers that are associated with the fields as the user encounters them.
- The user clicks one of the buttons that is defined by the
commandButtons()
function. - Adobe Dreamweaver executes the associated code. The dialog box remains visible until one of the scripts in the command calls the
window.close()
function.