PatternMaker adds a single property and a single method to the PageItem object. See the sample script that comes with BarcodeMaker to see how to script the plug-in. The following table gives more information.
Pattern and parameter names
The names of the patterns and parameters can be passed in as either the localized on non-localized strings. To find the non-localized string, do the following in InDesign desktop:
- Create a barcode that you're interested in scripting
- Drag and drop the barcode from InDesign to your desktop. This will create a snippet file on your desktop ending in .idms.
- Open the snippet file in a text editor. You'll find the non-localized version of the pattern name and all the parameter names. They all will contain the text A9B001. Search for that text and you'll find the strings. The pattern name will be assigned to the Pattern attribute, and all the parameters will be assigned to the PatternParameters attribute. Here are some examples of pattern and parameter names for a UPC-A barcode:
- $ID/0xA9B001kUPCAPatternName - Pattern name to pass to assign to pattern property
-
0xA9B00kUPCAParamName - UPCA parameter name to pass to setPatternParam
-
0xA9B00kAlttextOptionName - Alt Text paramaeter name to pass to setPatternParam
-
0xA9B00kISBNSuffixParamName - Suffix parameter name to pass to setPatternParam
PatternMaker methods
These events and properties all exist on page items. You can set a pattern by its name, and you can pattern parameters or individual properties. See the demo JavaScript that installs with the plug-in to see these events and properties in action. The script is called “PatternMakerParamsDemoScript.jsx”.
Name |
Parent |
Type |
Parameters |
Description |
|||||||||
JavaScript: VBScript: AppleScript |
page item |
Event |
|
Sets the paramater of a pattern. For example, for an ISBN barcode, parameters include “ISBN”, “Top font”, “Include text”, etc. Type the name of the parameter exactly as it appears in the PatternMaker palette. |
|||||||||
JavaScript and AppleScript: VBScript: |
page item |
Property |
This is a String property.. |
Set this property equal to the pattern name to apply a pattern. The pattern name should be exactly as it appears in the PatternMaker dropdown list of patterns. |
|||||||||
JavaScript: VBScript: AppleScript: |
page item |
Property |
This is a string property describing all parameters in a given parameter in a single string of name value pairs. Each pair is separated by a tilde (~) and names and values are separated by a colon (:). So a typical pattern’s parameters might look like this: EAN-2:10~Include text:true~Font:Verdana~Font style:Regular~Font size:10~Font position:0~Barcode Height:1~Ink Spread:0.15 |
Setting this property will set all parameters at once. it is much faster to use this property than to set parameters one at a time with SetPatternParam. |
Pattern Preset methods
The following preset methods operate on pattern presets, which can be found in a collection on either the document or the application. See the demo JavaScript that installs with the plug-in to see these events and properties in action. The script is called “PatternMakerPresetDemoScript.jsx”.
Name |
parent |
Type |
Parameters |
Description |
|||||||||
JavaScript: AppleScript VBScript: |
Page Item |
Event |
|
Applies a preset to a page item.. |
|||||||||
JavaScript: AppleScript VBScript: |
Pattern preset collection on the document or workspace |
Event |
|
Adds a new preset. The pattern for the preset will default to the first pattern available. You should make sure to set the pattern property on the preset immediately after creating the preset.. |
|||||||||
JavaScript AppleScript: VBScript: |
Pattern Preset |
Event |
This is an event with no parameters |
Removes the preset from the collection in which it is contained. |
|||||||||
JavaScript: VBScript: AppleScript |
Pattern Preset |
Event |
|
Sets the paramater of a pattern. For example, for an ISBN barcode, parameters include “ISBN”, “Top font”, “Include text”, etc. Type the name of the parameter exactly as it appears in the PatternMaker palette. |
|||||||||
JavaScript and AppleScriptt VBScript |
Pattern Preset |
Event |
|
Creates a duplicate of the preset |
|||||||||
JavaScript: VBScript: AppleScript: |
Pattern Preset |
Property |
This is a string property describing all parameters in a given parameter in a single string of name value pairs. Each pair is separated by a tilde (~) and names and values are separated by a colon (:). So a typical pattern’s parameters might look like this: EAN-2:10~Include text:true~Font:Verdana~Font style:Regular~Font size:10~Font position:0~Barcode Height:1~Ink Spread:0.15 |
Setting this property will set all parameters at once. it is much faster to use this property than to set parameters one at a time with SetPatternParam. |
|||||||||
JavaScript and ApplieScript: VBScript: |
Pattern Preset |
Property |
The preset’s pattern |
Setting this property will define what pattern is applied by the preset. |
|||||||||
JavaScript and ApplieScript: VBScript: |
Pattern Preset |
Property |
The preset’s name |
This is the name of the preset, that appears in the presets dropdown in the PatternMaker palette and in the Edit Presets dialog |
0 Comments