LayerAV_Layer
ObjectAVCommand

An AVCommand represents an action that the user can perform on the current document or the current selection in the current document. An AVCommand can be added to a command sequence and executed either interactively or by means of batch processing, using the method AVCommandExecute().

Invoking AVCommand objects programmatically

To invoke AVCommand objects programmatically using the AVCommand methods, a plug-in client must:

To instantiate an AVCommand, the client must call the AVCommandNew() method, providing the registered name of the command, as shown in the example below. For details on registering AVCommand handlers, see Developing Plug-ins and Applications.

Example

ASAtom cmdName;

AVCommand cmd;

cmdName = ASAtomFromString ("MinimalCommand");

cmd = AVCommandNew (cmdName);

Configuring Commands

Prior to executing the AVCommand, the client can configure three categories of properties:



Define Summary
 Define
 kAVCommandKeyASFileSys
AVCommandStringConstants
 kAVCommandKeyASPathName
AVCommandStringConstants
 kAVCommandKeyAVDoc
AVCommandStringConstants
 kAVCommandKeyBaseFileName
If possible, use kAVCommandKeyBaseFileNameASText instead.
 kAVCommandKeyBaseFileNameASText
AVCommandStringConstants
 kAVCommandKeyCanBatch
AVCommandStringConstants
 kAVCommandKeyCanDescribeParams
AVCommandStringConstants
 kAVCommandKeyCanPause
AVCommandStringConstants
 kAVCommandKeyCanShowDialog
AVCommandStringConstants
 kAVCommandKeyFireWhenModal
AVCommandStringConstants
 kAVCommandKeyGenericTitle
AVCommandStringConstants
 kAVCommandKeyGroupTitle
AVCommandStringConstants
 kAVCommandKeyInstructions
AVCommandStringConstants
 kAVCommandKeyIsDocStatus
 kAVCommandKeyIsStatus
AVCommandStringConstants
 kAVCommandKeyIsTask
 kAVCommandKeyNeedPause
AVCommandStringConstants
 kAVCommandKeyOrigExtension
AVCommandStringConstants
 kAVCommandKeyParams
AVCommandStringConstants
 kAVCommandKeyParamsDesc
AVCommandStringConstants
 kAVCommandKeyPDDoc
AVCommandStringConstants
 kAVCommandKeyScreenName
AVCommandStringConstants
 kAVCommandKeyTitle
AVCommandStringConstants
Typedef Summary
 Typedef
 AVCommand
An AVCommand represents an action that the user can perform on the current document or the current selection in the current document. Specifically, an AVCommand represents a command which can be added to a command sequence and executed either interactively or via batch processing.
 AVCommandHandler
 AVCommandHandlerRec
Enumeration Summary
 Enumeration
  AVCommandStatus
An enumerated list of status codes that can be returned by various AVCommand methods.
  AVCommandUIPolicy
An enumeration detailing how the command is expected to interact with the user.
Structure Summary
 Structure
 _t_AVCommandHandler
A set of callbacks that perform the actions required of a command.
Callback Summary
 Callback
 AVCommandCancelProc
Stop working and clean up as though the command executed to completion.
 AVCommandCreatedProc
Called after a command is created. The command handler can establish default parameters and so forth for the newly created command.
 AVCommandDestroyProc
Called before a command is destroyed. The command handler should free any memory allocated by the command.
 AVCommandGetProc
Retrieves a cabinet from a command. It is used in the GetParams and GetProps members of the AVCommandHandlerRec structure. When retrieving command parameters, the handler should first remove any existing items from theCab using ASCabMakeEmpty(), and then copy all parameter values from the command into theCab. When retrieving properties, the command handler should replace any entries in theCab with key names it recognizes with copies of the command-specific properties.
 AVCommandPostflightFileProc
Every command in a sequence has its Postflight command callback called after all commands in a given sequence have been executed but before the file is closed.
 AVCommandPostflightSequenceProc
Every command in a sequence has its Postflight command callback called after the sequence is executed.
 AVCommandPreflightFileProc
Every command in a sequence has its Preflight callback called after each file has been opened to be processed but before any commands have been executed on that file. If any of the Preflight callbacks returns an error, the sequence is aborted.
 AVCommandPreflightSequenceProc
Every command in a sequence has its Preflight callback called before the sequence is executed. If any of the Preflight callbacks returns an error, the sequence is aborted.
 AVCommandResetProc
Stops working, clears any errors, and tries to get back into a Ready state. For many commands this is equivalent to cancelling.
 AVCommandSetProc
Called to set a cabinet within a command. It is used in the SetParams member of the AVCommandHandlerRec structure. The command handler should copy any information from the cabinet into the command. It must not destroy or modify the cabinet.
 AVCommandShowDialogProc
Displays the command's parameter setting dialog box and allows the user to alter the parameters.
 AVCommandWorkProc
Do some work. If it does not finish its work, return kAVCommandWorking. If it does finish its work, return kAVCommandDone. If the user cancels the operation, return kAVCommandCanceled. If an error occurs, return kAVCommandInError.
Method Summary
 Method
 
AVCommandStatus AVCommandCancel(AVCommand cmd)
Cancels the specified command. If the command is currently processing a file, the command might not attempt to roll back any modifications it has made to the document. This may leave the PDF in an invalid state.
 
Destroys the specified command and its associated resources.
 
AVCommandStatus AVCommandExecute(AVCommand cmd)
Runs the specified AVCommand, after it has been set up using AVCommandSetInputs() and AVCommandSetParams().
 
Retrieves the AVDoc from a command's inputs ASCab.
 
ASCab AVCommandGetCab(AVCommand cmd, const char* cabName, ASBool create)
Returns the ASCab stored in the specified command under the key. If the cabinet is not available, this method will create it if create is set to true. The command retains ownership of the returned cabinet.
 
Returns a cancellation procedure for the command. If the user interface policy is anything other than kAVCommandUIInteractive, this cancellation procedure must be used. If the user interface policy is kAVCommandUIInteractive, an appropriate default cancel proc will be provided, but the command may use a more appropriate one it if preferred. Pass in the command itself as the client data.
 
Retrieves the configuration parameters for the specified command.
 
Retrieves the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. The contents of the cabinet are dependent on the mechanism through which the command is initialized.
 
Returns the name of the command.
 
Retrieves the parameter set for the specified command. It is possible that some commands have no parameters that can be configured, in which case no data will be written to params. The params cabinet should be empty when passed in. Upon return, it will be filled with copies of all of the command's parameter settings.
 
Retrieves the PDDoc from a command's inputs ASCab.
 
ASProgressMonitor AVCommandGetProgressMonitor(AVCommand cmd)
Returns a progress monitor the command can use to report progress. The command itself should be passed in as the clientData associated with the monitor's callbacks.
 
Retrieves the properties of the specified command. Properties are values intrinsic to the command or to the command's current state.
 
Returns the ASReportProc associated with the specified command. AVCommandHandlers should report all error and status messages through this procedure.
 
AVCommandStatus AVCommandGetStatus(AVCommand cmd)
Returns the current status of the specified command.
 
AVCommandUIPolicy AVCommandGetUIPolicy(AVCommand cmd)
Retrieves the user interface policy that the command will respect while it is executed. The user interface policy is determined by a combination of the command's configuration and the context in which the command is executing (for example, a batch sequence).
 
AVCommand AVCommandNew(ASAtom name)
Creates a new command of the specified type. An AVCommandHandler for that command type must have already been registered. See AVCommand Descriptions (Built-in Commands) for the names and parameters of built-in commands, as defined in AVCmdDefs.h.
 
void AVCommandPutCab(AVCommand cmd, const char* cabName, ASCab cabVal)
Stores a cabinet in the specified command. If a cabinet is currently stored under the key, it is overwritten. The command assumes ownership of cabVal.
 
AVCommandStatus AVCommandReset(AVCommand cmd)
Resets the specified command. The command is expected to clean up its current state and assume a ready state.
 
AVCommandStatus AVCommandSetConfig(AVCommand cmd, ASCab config)
Sets the configuration for the specified command. See AVCommandGetConfig() for more information.
 
AVCommandStatus AVCommandSetInputs(AVCommand cmd, ASCab inputs)
Sets the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. Use this method and AVCommandSetParams() to set up a command before calling AVCommandExecute() to execute it.
 
AVCommandStatus AVCommandSetParams(AVCommand cmd, ASCab params)
Sets the parameters for the specified command. The parameters are those pieces of information that can be controlled by the user, such as the pages to act on. Use this method and AVCommandSetInputs() to set up a command before calling AVCommandExecute() to execute it.
 
AVCommandStatus AVCommandShowDialog(AVCommand cmd)
Instructs the command to bring up its configuration dialog box and gather parameter information from the user. The dialog box is shown regardless of the UIPolicy of the command.
 
AVCommandStatus AVCommandWork(AVCommand cmd)
Instructs the command do some work based on its current parameters.
Defines Detail
kAVCommandKeyASFileSys 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyASFileSys "ASFileSys"

File: AVExpT.h
Line: 8832
kAVCommandKeyASPathName 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyASPathName "ASPathName"

File: AVExpT.h
Line: 8835
kAVCommandKeyAVDoc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyAVDoc "AVDoc"

File: AVExpT.h
Line: 8841
kAVCommandKeyBaseFileName 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyBaseFileName "BaseFileName"

Description

If possible, use kAVCommandKeyBaseFileNameASText instead.


File: AVExpT.h
Line: 8846
kAVCommandKeyBaseFileNameASText 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyBaseFileNameASText "BaseFileNameASText"

File: AVExpT.h
Line: 8849
kAVCommandKeyCanBatch 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyCanBatch "CanBatch"

File: AVExpT.h
Line: 8870
kAVCommandKeyCanDescribeParams 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyCanDescribeParams "CanDescribeParams"

File: AVExpT.h
Line: 8867
kAVCommandKeyCanPause 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyCanPause "CanPause"

File: AVExpT.h
Line: 8888
kAVCommandKeyCanShowDialog 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyCanShowDialog "CanShowDialog"

File: AVExpT.h
Line: 8873
kAVCommandKeyFireWhenModal 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyFireWhenModal "FireWhenModal"

File: AVExpT.h
Line: 8882
kAVCommandKeyGenericTitle 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyGenericTitle "GenericTitle"

File: AVExpT.h
Line: 8855
kAVCommandKeyGroupTitle 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyGroupTitle "GroupTitle"

File: AVExpT.h
Line: 8876
kAVCommandKeyInstructions 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyInstructions "Instructions"

File: AVExpT.h
Line: 8891
kAVCommandKeyIsDocStatus 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyIsDocStatus "IsDocStatus"

File: AVExpT.h
Line: 10075
kAVCommandKeyIsStatus 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyIsStatus "IsStatus"

File: AVExpT.h
Line: 8879
kAVCommandKeyIsTask 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyIsTask "IsTask"

File: AVExpT.h
Line: 9970
kAVCommandKeyNeedPause 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyNeedPause "NeedPause"

File: AVExpT.h
Line: 8885
kAVCommandKeyOrigExtension 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyOrigExtension "OrigExtension"

File: AVExpT.h
Line: 8852
kAVCommandKeyParams 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyParams "Params"

File: AVExpT.h
Line: 8861
kAVCommandKeyParamsDesc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyParamsDesc "ParamsDesc"

File: AVExpT.h
Line: 8864
kAVCommandKeyPDDoc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyPDDoc "PDDoc"

File: AVExpT.h
Line: 8838
kAVCommandKeyScreenName 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyScreenName "ScreenName"

File: AVExpT.h
Line: 8894
kAVCommandKeyTitle 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

#define kAVCommandKeyTitle "Title"

File: AVExpT.h
Line: 8858

Typedefs Detail
AVCommand 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

typedef struct _t_AVCommandRec* AVCommand;

An AVCommand represents an action that the user can perform on the current document or the current selection in the current document. Specifically, an AVCommand represents a command which can be added to a command sequence and executed either interactively or via batch processing.


File: AVExpT.h
Line: 8961
AVCommandHandler 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

typedef AVCommandHandlerRec AVCommandHandler;

File: AVExpT.h
Line: 9281
AVCommandHandlerRec 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

typedef _t_AVCommandHandler AVCommandHandlerRec;

File: AVExpT.h
Line: 9280

Enumeration Detail
AVCommandStatus
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

See Also


File: AVExpT.h
Line: 8901

Elements
kAVCommandReady  

Not working, but ready to work.

 
kAVCommandWorking  

Still working.

 
kAVCommandDone  

Done working.

 
kAVCommandCanceled  

Cancelled.

 
kAVCommandInError  

In error.

 
kAVCommandCanceledForMultiple  

Cancelled in favor of running this command (with the current parameters) in a sequence of multiple files.

 
kAVCommandNotExecuted  

Command not executed due to lack of objects on which the command to be executed.

 
kAVCommandPaused  

Paused.

AVCommandUIPolicy 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

enum AVCommandUIPolicy {
 kAVCommandUIInteractive = 0,
 
 kAVCommandUISemiInteractive = 1,
 
 kAVCommandUIErrorsOnly = 2,
 
 kAVCommandUISilent = 3
}

See Also


File: AVExpT.h
Line: 8935

Elements
kAVCommandUIInteractive  

Fully interactive. Gather parameters based on the currently active document at the time the dialog box is displayed. Display errors and warnings.

 
kAVCommandUISemiInteractive  

Interactive but under the control of the sequencing user interface. When showing a dialog box, use the parameters passed in, rather than the parameters gathered from the document.

 
kAVCommandUIErrorsOnly  

Display errors but no other dialog boxes.

 
kAVCommandUISilent  

Never display a dialog box.


Structure Detail
_t_AVCommandHandler
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

A set of callbacks that perform the actions required of a command.


File: AVExpT.h
Line: 9207

Elements
size  

The size of the structure. Set it to sizeof(AVCommandHandlerRec).

 
Initialize  

Called once for each handler registered.

 
Terminate  

Called once for each handler registered when Acrobat shuts down. It is called before plug-ins are unloaded

 
RegisterCommands  

The application maintains a global list of commands that you can choose from when building your own command. During the initialization sequence, all registered command handlers are asked to build and register all the commands that the handler wants to include in the global command list.

 
Created  

Called after a command is created. The command handler can establish default parameters and so forth for the newly created command.

 
Destroy  

Called before a command is destroyed. The command handler should free any memory allocated by the command, and so on.

 
SetParams  

Called to set the command's parameters.

 
GetParams  

Called to retrieve the command's parameters.

 
GetProps  

Called to retrieve command properties.

 
ShowDialog  

Displays the command's parameter setting dialog box and allows the user to alter the parameters.

 
Work  

Do some work. If the command does not finish the work, return kAVCommandWorking. If the command finishes the work, return kAVCommandDone. If the user cancels the operation, return kAVCommandCanceled. If an error occurs, return kAVCommandInError. In most cases the work procedure will be called until you return kAVCommandDone, but in some cases, you may be called upon to Cancel or Reset before the work is done.

 
Cancel  

Stop working and pretend it reached a point where all work was done.

 
Reset  

Stop working, clear any errors, and try to get back into a ready state. For many commands this is equivalent to cancelling.

 
PreflightSequence  

See the sequence description in the callback reference.

 
PreflightFile  

See the sequence description in the callback reference.

 
PostflightFile  

See the sequence description in the callback reference.

 
PostflightSequence  

See the sequence description in the callback reference.

 
reserved  

Reserved for internal use. It must be NULL.

Callbacks Detail
AVCommandCancelProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandCancelProc)(AVCommand cmd)

Stop working and clean up as though the command executed to completion.

See Also


File: AVExpT.h
Line: 9085
AVCommandCreatedProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void (*AVCommandCreatedProc)(AVCommand cmd)

Called after a command is created. The command handler can establish default parameters and so forth for the newly created command.

See Also


File: AVExpT.h
Line: 9007
AVCommandDestroyProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void (*AVCommandDestroyProc)(AVCommand cmd)

Called before a command is destroyed. The command handler should free any memory allocated by the command.

See Also


File: AVExpT.h
Line: 9017
AVCommandGetProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void (*AVCommandGetProc)(AVCommand cmd, ASCab theCab)

Retrieves a cabinet from a command. It is used in the GetParams and GetProps members of the AVCommandHandlerRec structure. When retrieving command parameters, the handler should first remove any existing items from theCab using ASCabMakeEmpty(), and then copy all parameter values from the command into theCab. When retrieving properties, the command handler should replace any entries in theCab with key names it recognizes with copies of the command-specific properties.


File: AVExpT.h
Line: 9047
AVCommandPostflightFileProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandPostflightFileProc)(AVCommand cmd, PDDoc doc)

Every command in a sequence has its Postflight command callback called after all commands in a given sequence have been executed but before the file is closed.

Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).

See AVCommandPreflightSequenceProc() for the order in which the AVCommand Pre/Postflight callbacks are called.


File: AVExpT.h
Line: 9179
AVCommandPostflightSequenceProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandPostflightSequenceProc)(AVCommand cmd)

Every command in a sequence has its Postflight command callback called after the sequence is executed.

Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).

See AVCommandPreflightSequenceProc() for the order in which the AVCommand Pre/Postflight callbacks are called.


File: AVExpT.h
Line: 9200
AVCommandPreflightFileProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandPreflightFileProc)(AVCommand cmd, PDDoc doc)

Every command in a sequence has its Preflight callback called after each file has been opened to be processed but before any commands have been executed on that file. If any of the Preflight callbacks returns an error, the sequence is aborted.

Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).

See AVCommandPreflightSequenceProc() for the order in which the AVCommand Pre/Postflight callbacks are called.


File: AVExpT.h
Line: 9156
AVCommandPreflightSequenceProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandPreflightSequenceProc)(AVCommand cmd)

Every command in a sequence has its Preflight callback called before the sequence is executed. If any of the Preflight callbacks returns an error, the sequence is aborted.

Preflights and Postflights are good for getting user data or preparing the command at the beginning of the sequence. For example, you could use the Preflight to ask what password the 'Add Security' command should use. This is important since you only want to ask once (not for every file), and you do not want to store the password in the sequence file (or the command's persistent parameters).


File: AVExpT.h
Line: 9131
AVCommandResetProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandResetProc)(AVCommand cmd)

Stops working, clears any errors, and tries to get back into a Ready state. For many commands this is equivalent to cancelling.

See Also


File: AVExpT.h
Line: 9097
AVCommandSetProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandSetProc)(AVCommand cmd, ASCab cab)

Called to set a cabinet within a command. It is used in the SetParams member of the AVCommandHandlerRec structure. The command handler should copy any information from the cabinet into the command. It must not destroy or modify the cabinet.

See Also


File: AVExpT.h
Line: 9031
AVCommandShowDialogProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandShowDialogProc)(AVCommand cmd)

Displays the command's parameter setting dialog box and allows the user to alter the parameters.


File: AVExpT.h
Line: 9057
AVCommandWorkProc 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus (*AVCommandWorkProc)(AVCommand cmd)

Do some work. If it does not finish its work, return kAVCommandWorking. If it does finish its work, return kAVCommandDone. If the user cancels the operation, return kAVCommandCanceled. If an error occurs, return kAVCommandInError.

In most cases this method performs its work until it returns kAVCommandDone, but in some cases it may be called on to cancel or reset before its work is done.

See Also


File: AVExpT.h
Line: 9074

Method Detail
AVCommandCancel()
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandCancel(AVCommand cmd)

Cancels the specified command. If the command is currently processing a file, the command might not attempt to roll back any modifications it has made to the document. This may leave the PDF in an invalid state.

Parameters

cmd — 

The command to cancel. See AVCommand Descriptions (Built-in Commands).

Returns

The current status of cmd. It should be kAVCommandCanceled.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5023
AVCommandDestroy() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void AVCommandDestroy(AVCommand cmd)

Destroys the specified command and its associated resources.

Parameters

cmd — 

The command to destroy. See AVCommand Descriptions (Built-in Commands).

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4662
AVCommandExecute() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandExecute(AVCommand cmd)

Runs the specified AVCommand, after it has been set up using AVCommandSetInputs() and AVCommandSetParams().

The method runs the command using the following process:

This method should be used when the client does not need the level of control provided when calling AVCommandWork() directly. Specifically, this method is useful for using a global command from within a menu or a toolbar button's execution procedure.

Parameters

cmd — 

The command to execute. See AVCommand Descriptions (Built-in Commands).

Returns

The current status of cmd.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5224
AVCommandGetAVDoc() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVDoc AVCommandGetAVDoc(AVCommand cmd)

Retrieves the AVDoc from a command's inputs ASCab.

Parameters

cmd — 

The command to be queried. See AVCommand Descriptions (Built-in Commands).

Returns

The AVDoc if it was found, NULL otherwise.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5071
AVCommandGetCab() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

ASCab AVCommandGetCab(AVCommand cmd, const char* cabName, ASBool create)

Returns the ASCab stored in the specified command under the key. If the cabinet is not available, this method will create it if create is set to true. The command retains ownership of the returned cabinet.

This method can only be exercised by an AVCommandHandler. Command handlers can use this call to attach arbitrary information to a command. Only the command handler should access these cabinets. See AVCommandSetInputs() and AVCommandSetParams().

Parameters

cmd — 

The command to be queried. See AVCommand Descriptions (Built-in Commands).

 
cabName — 

The key under which the cabinet is stored.

 
create — 

Pass true to have this method create the cabinet if it does not exist.

Returns

The cabinet if it was found or created, NULL otherwise.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4702
AVCommandGetCancelProc() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

ASCancelProc AVCommandGetCancelProc(AVCommand cmd)

Returns a cancellation procedure for the command. If the user interface policy is anything other than kAVCommandUIInteractive, this cancellation procedure must be used. If the user interface policy is kAVCommandUIInteractive, an appropriate default cancel proc will be provided, but the command may use a more appropriate one it if preferred. Pass in the command itself as the client data.

Parameters

cmd — 

The command whose cancellation procedure is returned. See AVCommand Descriptions (Built-in Commands).

Returns

The cancellation procedure.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5131
AVCommandGetConfig() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void AVCommandGetConfig(AVCommand cmd, ASCab config)

Retrieves the configuration parameters for the specified command.

Configuration values are controlled by the mechanism that is driving the command, such as a client or the batch framework. For example, one configuration value determines whether to display a dialog box while executing; it can be a setting that the user can toggle through the user interface, or a client can set it through AVCommandSetConfig().

To retrieve all the configuration parameters, pass in an empty cabinet for config and the method will fill in the cabinet with the current configuration keys and values. To retrieve specific configuration parameter values, fill the initial dictionary with the keys in which you are interested, each with a NULL value, and the method will attempt to fill in the appropriate value for each key.

Currently the only configuration parameters defined are:

Parameter

Description

UIPolicy (kASValueInteger)

The local user interface policy for this command.

ParamsDescOpen (kASValueBool)

Indicates whether the description of this command's parameters is visible in the sequence view.

Parameters

cmd — 

The command whose configuration parameters are being retrieved. See AVCommand Descriptions (Built-in Commands).

 
config — 

(Filled by the method) An ASCab into which the parameters are written.

See Also

Since

PI_ASEXTRA_VERSION >= 0x00050000

File: AVProcs.h
Line: 4840
AVCommandGetInputs() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void AVCommandGetInputs(AVCommand cmd, ASCab inputs)

Retrieves the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. The contents of the cabinet are dependent on the mechanism through which the command is initialized.

The batch framework attempts to provide the following:

Key (see Command Keys)

Stored As

Description

kAVCommandKeyPDDoc

kASValuePointer

The document being processed.

kAVCommandKeyBaseFileName

kASValueString

The name of the input file, without extension.

kAVCommandKeyOrigExtension

kASValueString

The extension of the input file.

Clients should also attempt to provide this information. The content of the inputs cabinet is not limited to the keys listed above. Clients (or the command handler itself ) can specify additional inputs as necessary. The caller retains ownership of inputs.

Parameters

cmd — 

The command whose input parameters are being retrieved. See AVCommand Descriptions (Built-in Commands).

 
inputs — 

(Filled by the method) The input parameters.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4968
AVCommandGetName() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

ASAtom AVCommandGetName(AVCommand cmd)

Returns the name of the command.

Parameters

cmd — 

The command whose name is returned. See AVCommand Descriptions (Built-in Commands).

Returns

The command name.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4671
AVCommandGetParams() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void AVCommandGetParams(AVCommand cmd, ASCab params)

Retrieves the parameter set for the specified command. It is possible that some commands have no parameters that can be configured, in which case no data will be written to params. The params cabinet should be empty when passed in. Upon return, it will be filled with copies of all of the command's parameter settings.

The caller retains ownership of params.

Parameters

cmd — 

The command whose parameters are being retrieved. See AVCommand Descriptions (Built-in Commands).

 
params — 

(Filled by the method) An ASCab into which the parameter set is written.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4771
AVCommandGetPDDoc() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

PDDoc AVCommandGetPDDoc(AVCommand cmd)

Retrieves the PDDoc from a command's inputs ASCab.

Parameters

cmd — 

The command to be queried. See AVCommand Descriptions (Built-in Commands).

Returns

A PDDoc if it was found, NULL otherwise.

Since

PI_ASEXTRA_VERSION >= 0x00050000

File: AVProcs.h
Line: 5080
AVCommandGetProgressMonitor() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

ASProgressMonitor AVCommandGetProgressMonitor(AVCommand cmd)

Returns a progress monitor the command can use to report progress. The command itself should be passed in as the clientData associated with the monitor's callbacks.

Command handlers should use this progress monitor rather than a custom implementation.

If the command is driven by the batch framework, the progress monitor updates the batch progress dialog box. If the command is driven by a client and the AVDoc input key has been set, the progress monitor updates the progress pane at the bottom of the document's window; otherwise, the progress monitor's callbacks are no-ops.

Parameters

cmd — 

The command to be queried. See AVCommand Descriptions (Built-in Commands).

Returns

The command progress monitor.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5115
AVCommandGetProps() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void AVCommandGetProps(AVCommand cmd, ASCab props)

Retrieves the properties of the specified command. Properties are values intrinsic to the command or to the command's current state.

To retrieve properties, create a cabinet containing the keys for the properties in which you are interested (the values should be invalid, such as NULL), and pass it into this method. The command will copy the requested properties into your cabinet. If the cabinet is empty, the command will fill in all properties.

The following properties are pre-defined:

Property

Description

CanShowDialog (kASValueBool)

Indicates that the command can show a configuration dialog box. Support of this property is optional; it defaults to false.

CanDescribeParams (kASValueBool)

Indicates that the command can provide a description of its parameters. Support of this property is optional; it defaults to false. If the command sets this property to true, it should support the ParamDesc property also.

ParamsDesc (kASValueCabinet)

A cabinet containing numeric keys (for example, '1', '2', ..., 'n' with kASValueText values describing the command's parameters). The text items will be displayed in the sequence dialog box in the numerical order of the keys.

CanBatch (kASValueBool)

Indicates that the command should appear in the list of commands that can be batched. Support of this property is optional; it defaults to false. If the command set returns this property value as true, it must also support the GenericTitle and GroupTitle properties.

GroupTitle (kASValueText)

The name of the group to which this command belongs. Currently the GroupTitles are localized strings, so they vary from one language to another. The English GroupTitles are those listed in the edit sequence dialog box: 'Comments', 'Document', 'JavaScript', 'Page', and 'PDF Consultant'.

GenericTitle (kASValueText)

The generic name for this command (for example, 'Show/ Hide Bookmarks', 'Rotate Pages', and so forth). This is used when displaying the command in the list of global commands.

Title (kASValueText)

The specific title for this command (for example, 'Hide Bookmarks' taking the command's parameters into account). This is used for displaying a specific command within a sequence.

Parameters

cmd — 

The command whose properties are being retrieved. See AVCommand Descriptions (Built-in Commands).

 
props — 

(Filled by the method) The command properties. The caller retains ownership of the ASCab.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4898
AVCommandGetReportProc() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

ASReportProc AVCommandGetReportProc(AVCommand cmd)

Returns the ASReportProc associated with the specified command. AVCommandHandlers should report all error and status messages through this procedure.

Pass the AVCommand itself as the clientData parameter when calling the procedure.

Parameters

cmd — 

The command whose ASReportProc is returned. See AVCommand Descriptions (Built-in Commands).

Returns

The ASReportProc.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5094
AVCommandGetStatus() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandGetStatus(AVCommand cmd)

Returns the current status of the specified command.

Parameters

cmd — 

The command whose status is returned. See AVCommand Descriptions (Built-in Commands).

Returns

The current status of cmd.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4680
AVCommandGetUIPolicy() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandUIPolicy AVCommandGetUIPolicy(AVCommand cmd)

Retrieves the user interface policy that the command will respect while it is executed. The user interface policy is determined by a combination of the command's configuration and the context in which the command is executing (for example, a batch sequence).

Parameters

cmd — 

The command whose user interface policy is returned. See AVCommand Descriptions (Built-in Commands).

Returns

The user interface policy.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5055
AVCommandNew() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommand AVCommandNew(ASAtom name)

Creates a new command of the specified type. An AVCommandHandler for that command type must have already been registered. See AVCommand Descriptions (Built-in Commands) for the names and parameters of built-in commands, as defined in AVCmdDefs.h.

Parameters

name — 

The new command's type name.

Returns

The new command, or NULL if the specified type has not been registered.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4652
AVCommandPutCab() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

void AVCommandPutCab(AVCommand cmd, const char* cabName, ASCab cabVal)

Stores a cabinet in the specified command. If a cabinet is currently stored under the key, it is overwritten. The command assumes ownership of cabVal.

This method can only be exercised by an AVCommandHandler. Command handlers can use this call to store state information (such as parameters) in a command. Only the command handler associated with the command should access these cabinets. See AVCommandSetInputs() and AVCommandSetParams().

Parameters

cmd — 

The command. See AVCommand Descriptions (Built-in Commands).

 
cabName — 

(May be NULL) The key name under which the cabinet will be stored. If NULL, a numerical name is generated and used.

 
cabVal — 

(May be NULL) The cabinet to store. If NULL, the method destroys the cabinet currently stored under the key (if any).

See Also

Exceptions

genErrBadParm

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4726
AVCommandReset() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandReset(AVCommand cmd)

Resets the specified command. The command is expected to clean up its current state and assume a ready state.

If the command is currently processing a file, the command might not attempt to roll back any modifications it has made to the PDF. This may leave the PDF in an invalid state.

Parameters

cmd — 

The command to reset. See AVCommand Descriptions (Built-in Commands).

Returns

The current status of cmd.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5040
AVCommandSetConfig() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandSetConfig(AVCommand cmd, ASCab config)

Sets the configuration for the specified command. See AVCommandGetConfig() for more information.

config will be merged with the current configuration cabinet to generate the new configuraton. To erase configuration settings, set their values to NULL in your cabinet.

Currently the only configuration parameters defined are:

Parameter

Description

UIPolicy (kASValueInteger)

The local user interface policy for this command.

ParamsDescOpen (kASValueBool)

Indicates whether the description of this command's parameters is visible in the sequence view.

The caller retains ownership of config.

Parameters

cmd — 

The command whose configuration parameters are being set. See AVCommand Descriptions (Built-in Commands).

 
config — 

The configuration settings.

Returns

The current status of cmd. The configuration settings will not be updated if the command is not in a ready state.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4799
AVCommandSetInputs() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandSetInputs(AVCommand cmd, ASCab inputs)

Sets the input parameters of the specified command. The inputs of a command consist of an ASCab detailing properties of the object on which the command will operate. Use this method and AVCommandSetParams() to set up a command before calling AVCommandExecute() to execute it.

A command handler should provide at least the following information:

Key (see Command Keys)

Stored As

Description

kAVCommandKeyPDDoc

kASValuePointer

The document being processed.

kAVCommandKeyBaseFileName

kASValueString

The name of the input file, without extension.

kAVCommandKeyOrigExtension

kASValueString

The extension of the input file.

The command handler can specify additional inputs as necessary. The caller retains ownership of inputs.

Parameters

cmd — 

The command whose inputs are being set. See AVCommand Descriptions (Built-in Commands).

 
inputs — 

The input parameters.

Returns

The current status of cmd. The input settings will not be updated if the command is not in a ready state.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4934
AVCommandSetParams() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandSetParams(AVCommand cmd, ASCab params)

Sets the parameters for the specified command. The parameters are those pieces of information that can be controlled by the user, such as the pages to act on. Use this method and AVCommandSetInputs() to set up a command before calling AVCommandExecute() to execute it.

Setting any parameters for a command sets all parameters. The command supplies appropriate default parameters for any that are missing from params. Passing an empty cabinet causes all parameters to be set to their default values.

If the command is not in a ready state, the parameters are not updated.

The caller retains ownership of params.

Parameters

cmd — 

The command whose parameters are being set. See AVCommand Descriptions (Built-in Commands).

 
params — 

The parameters to be set.

Returns

The status of cmd after the parameters are set.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4753
AVCommandShowDialog() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandShowDialog(AVCommand cmd)

Instructs the command to bring up its configuration dialog box and gather parameter information from the user. The dialog box is shown regardless of the UIPolicy of the command.

If the user confirms the configuration dialog box, the cmd object's parameter set is updated; otherwise cmd will enter a cancelled state.

Query cmd for its kAVCommandKeyCanShowDialog property using AVCommandGetProps() to determine whether it has a configuration dialog box.

Parameters

cmd — 

The command for which the dialog box is thrown. See AVCommand Descriptions (Built-in Commands).

Returns

The current status of cmd.

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 4986
AVCommandWork() 
Product availability: Acrobat, Reader
Platform availability: Macintosh, Windows, UNIX

Syntax

AVCommandStatus AVCommandWork(AVCommand cmd)

Instructs the command do some work based on its current parameters.

A command will either divide its processing across multiple AVCommandWork() calls, or perform all the processing within a single call.

If cmd is in a working state upon return, it is the client's responsibility to poll the command's cancel proc, before calling AVCommandWork() again, to continue processing.

Parameters

cmd — 

The command that is instructed to do some work. See AVCommand Descriptions (Built-in Commands).

Returns

The current status of cmd. No processing is performed if the command cannot be put in a ready or working state.

See Also

Since

PI_ACROVIEW_VERSION >= 0x00050000

File: AVProcs.h
Line: 5008