If you want to direct files to a new
native application, you must create a script XML file for that application.
If you want to modify how the Generate PDF service interacts with
a native application that is already supported, you must modify
the script for that application.
The script contains instructions that navigate through the native
application’s window elements and that supply specific responses
to those elements. The file that contains this information is appmon.[appname].script.[locale].xml.
An example is appmon.notepad.script.en_US.xml.
Identifying steps the script must executeUsing the native application, determine the window elements
that you must navigate and each response you must perform to print
the document. Notice the dialog boxes that result from any response.
The steps will be similar to these steps:
Select File > Open.
Specify the path and then click Open.
Select File > Print on the menu bar.
Specify the properties required for the printer.
Select Print and wait for the Save As dialog box to appear.
The Save As dialog box is required for the Generate PDF service
to specify the destination for the PDF file.
Identifying the dialogs specified in caption attributesUse
Microsoft Spy++ to obtain the identities of window element properties
in the native application. You must have these identities to write
scripts.
Using regular expressions in caption attributesYou can use regular
expressions in caption specifications. The Generate PDF service
uses the java.util.regex.Matcher class to support
regular expressions. That utility supports the regular expressions
described in java.util.regex.Pattern. (Go to the
Java website at http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html.)
Regular expression accommodating the file name prepended to Notepad in the Notepad banner<!-- The regular expression ".*Notepad" means any number of non-terminating characters followed by Notepad. -->
<step>
<expectedWindow>
<window caption=".*Notepad"/>
</expectedWindow>
</step>
Regular expression differentiating Print from Print Setup<!-- This regular expression differentiates the Print dialog box from the Print Setup dialog box. The "^" specifies the beginning of the line, and the "$" specifies the end of the line. -->
<windowList>
<window controlID="0x01" caption="^Print$" action="press"/>
</windowList>
Ordering the window and windowList elementsYou must order window and windowList elements
as follows:
When multiple window elements appear
as children in a windowList or dialog element,
order those window elements in descending order,
with the lengths of the caption names indicating
the position in the order.
When multiple windowList elements appear
in a window element, order those windowList elements
in descending order, with the lengths of the caption attributes
of the first indexes/element indicating the position
in the order.
Ordering window elements in a dialog file<!-- The caption attribute in the following window element is 40 characters long. It is the longest caption in this example, so its parent window element appears before the others. -->
<window caption="Unexpected Failure in DebugActiveProcess">
<…>
</window>
<!-- Caption length is 33 characters. -->
<window caption="Adobe Acrobat - License Agreement">
<…>
</window>
<!-- Caption length is 33 characters. -->
<window caption="Microsoft Visual.*Runtime Library">
<…>
</window>
<!-- The caption attribute in the following window element is 28 characters long. It is the shortest caption in this example, so its parent window element appears after the others. -->
<window caption="Adobe Acrobat - Registration">
<…>
</window>
Ordering window elements within a windowList element<!-- The caption attribute in the following indexes element is 56 characters long. It is the longest caption in this example, so its parent window element appears before the others. -->
<windowList>
<window caption="Can't exit design mode because.* cannot be created"/>
<window className="Button" caption="OK" action="press"/>
</windowList>
<windowList>
<window caption="Do you want to continue loading the project?"/>
<window className="Button" caption="No" action="press"/>
</windowList>
<windowList>
<window caption="The macros in this project are disabled"/>
<window className="Button" caption="OK" action="press"/>
</windowList>
|
|
|