Adobe InDesign CS4 (6.0) Object Model JS: Array

InDesign CS4

Class

Array

  The Array class is an array with integer indexes and a length property.

QuickLinks

Array, concat, join, pop, push, reverse, shift, slice, sort, splice, toLocaleString, toSource, toString, unshift

Properties

PropertyTypeAccessDescription
lengthnumber r/wThe length of the array

Methods

Constructor

Array Array (length: number)
Creates and returns a new array.
The parameter is either a number that sets the initial length of the array, or a list of initial array values. Note that a one-elementh list always results in the array length being set. Returns the new array

ParameterTypeDescription
lengthnumber

Examplenew Array()

Instances

Array concat (value: any)
Returns a new array created by concatenating the given values to the end of the original array.
The original array is unchanged. If an array is provided as a parameter to concat(), each of its elements are appended as separate array elements at the end of the new array. Returns a new array, the result of concatenation the given values to the end of the original array.

ParameterTypeDescription
value any Any number of values to be added to the end of the array.
Can also be arrays.

Examplearray.concat(value1,...valueN)

string join ([delimiter: string])
Joins all elements of the array into a string; optionally, each element is separated by delimiter.
Returns the string containing the joined elements and delimiters.

ParameterTypeDescription
delimiterstringA string used to separate each element of the array.
If omitted, the array elements are separated with a comma. (Optional)

Examplearray.join(delimiter)

any pop ()
Removes the last element from the array, decreases the length by 1, and returns the value of the element.
Returns the value of the deleted array element.

Examplearray.pop()

number push (value: number)
Places one or more values onto the end of the array and increases length by n.
Returns the new length of the array.

ParameterTypeDescription
valuenumberAny number of values to be pushed onto the end of the array.

Examplearray.push(value1,...valueN)

Array reverse ()
Reverses the order of the elements in the array.
Returns the reversed array.

Examplearray.reverse()

any shift ()
Removes the first element from the array, decreases the length by 1, and returns the value of the element.
Returns the value of the deleted array element.

Examplearray.shift()

Array slice ()
Creates a new array, which contains a subset of the original array's elements.
The slice begins with the index start, and continues up to, but not including the index, end. If start or end is a negative number, the indexed is resolved counting backwards from the end of the array resulting in the element array[array. length + negativeIndex]. Returns a new array containing elements array[start] through array[end-1].

Examplearray.slice(start, end)

void sort (userFunction: Function)
Sorts the elements of the array in place, using the given function to compare to elements.
If no function is provided, the elements are sorted alphabetically. Returns no return value.

ParameterTypeDescription
userFunctionFunctionA user-supplied function of the form userFunction(a, b) which returns less than 0 if a is greater than b, 0 if a and b are equal, and greater than 0 if b is greater than a.

Examplearray.sort(userFunction)

Array splice (start: number[, num: number][, value: any])
Removes num elements from the array beginning with index, start.
Optionally insert new elements beginning at index start. To ensure contiguity, elements are moved up to fill in any gaps. Returns a new array containing any elements deleted from the original array.

ParameterTypeDescription
startnumberThe index of the first element to remove. Negative values are relative to the end of the array.
numnumberThe number of array elements to remove, including start. If omitted, all elements from array index start to the end of the array are removed.
(Optional)
value any A list of one or more values to be added to the array starting at index start.
Must specify a value for num, to use this argument. (Optional)

Examplearray.splice(start, num, value1, ...valuen)

string toLocaleString ()
Converts an array to a string and returns the string (localized).

string toSource ()
Creates a string representation of this object that can be fed back to eval() to re-create an object. Works only with built-in classes.

string toString ()
Converts an array to a string and returns the string.
Yields the same result as array. join() when called without a parameter. Returns a comma-separated list of all the elements of the array.

Examplearray.toString()

number unshift (value: any)
Adds one or more elements to the beginning of the array.
Returns the new array length.

ParameterTypeDescription
value any The values of one or more elements to be added to the beginning of the array.

Examplearray.unshift(value1,...valuen)

Element of

Application.userColor

Assignment.frameColor

AutoCorrectTable.autoCorrectWordPairList

BaselineFrameGridOption.baselineFrameGridColor

Cell.contents

CellStyle.gradientFillStart

ChangeGrepPreference.appliedConditions

ChangeGrepPreference.gradientFillStart

ChangeGrepPreference.gradientStrokeStart

ChangeObjectPreference.baselineFrameGridColor

ChangeObjectPreference.insetSpacing

ChangeObjectPreference.strokeDashAndGap

ChangeTextPreference.appliedConditions

ChangeTextPreference.gradientFillStart

ChangeTextPreference.gradientStrokeStart

Character.opentypeFeatures

Character.parentTextFrames

Character.tabList

CharacterStyle.gradientFillStart

CharacterStyle.gradientStrokeStart

CharacterStyle.previewColor

Column.contents

Condition.indicatorColor

DocumentPreference.columnGuideColor

DocumentPreference.marginGuideColor

FindChangeGradientFeatherSetting.gradientStart

FindGlyphPreference.rosFontGroup

FindGrepPreference.appliedConditions

FindGrepPreference.gradientFillStart

FindGrepPreference.gradientStrokeStart

FindObjectPreference.baselineFrameGridColor

FindObjectPreference.insetSpacing

FindObjectPreference.strokeDashAndGap

FindTextPreference.appliedConditions

FindTextPreference.gradientFillStart

FindTextPreference.gradientStrokeStart

Footnote.contents

GalleyPreference.backgroundColor

GalleyPreference.textColor

GridPreference.baselineColor

GridPreference.gridColor

Guide.guideColor

GuidePreference.rulerGuidesColor

Hyperlink.borderColor

InsertionPoint.opentypeFeatures

InsertionPoint.parentTextFrames

InsertionPoint.tabList

Layer.layerColor

LayoutWindow.transformReferencePoint

Line.opentypeFeatures

Line.parentTextFrames

Line.tabList

NotePreference.noteColor

Page.masterPageItems

Paragraph.opentypeFeatures

Paragraph.parentTextFrames

Paragraph.tabList

ParagraphStyle.previewColor

ParagraphStyle.tabList

PasteboardPreference.bleedGuideColor

PasteboardPreference.previewBackgroundColor

PasteboardPreference.slugGuideColor

Path.entirePath

Row.contents

RuleDataObject.dataValue

ScriptPreference.scriptsList

SmartGuidePreference.guideColor

SpellPreference.misspelledWordColor

SpellPreference.repeatedWordColor

SpellPreference.uncapitalizedSentenceColor

SpellPreference.uncapitalizedWordColor

Story.opentypeFeatures

Story.tabList

Story.textContainers

Table.contents

Text.opentypeFeatures

Text.parentTextFrames

Text.tabList

TextColumn.opentypeFeatures

TextColumn.parentTextFrames

TextColumn.tabList

TextDefault.tabList

TextFramePreference.insetSpacing

TextStyleRange.opentypeFeatures

TextStyleRange.parentTextFrames

TextStyleRange.tabList

TextWrapPreference.textWrapOffset

TransformationMatrix.matrixMapping

Word.opentypeFeatures

Word.parentTextFrames

Word.tabList

XMLPreference.defaultCellTagColor

XMLPreference.defaultImageTagColor

XMLPreference.defaultStoryTagColor

XMLPreference.defaultTableTagColor

XMLTag.tagColor

XmlStory.opentypeFeatures

XmlStory.tabList

XmlStory.textContainers

Used in:

any Application.open (from: any[, showingWindow: bool=true])

void Application.place (fileName: any[, showingOptions: bool=false][, withProperties: Object])

void Application.print (from: any[, printDialog: bool][, using: any])

void Application.select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE_WITH])

PageItem Button.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Button.flipItem (given: Flip[, around: any])

void Button.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Button.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Button.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Button.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

Swatch Color.merge (with: any)

void Document.place (fileName: any[, showingOptions: bool=false][, withProperties: Object])

void Document.select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE_WITH])

PageItem EPS.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void EPS.flipItem (given: Flip[, around: any])

void EPS.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void EPS.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any EPS.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void EPS.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem FormField.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void FormField.flipItem (given: Flip[, around: any])

void FormField.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void FormField.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any FormField.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void FormField.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

any Function.apply (thisObj: Object, args: Array)

Swatch Gradient.merge (with: any)

PageItem Graphic.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Graphic.flipItem (given: Flip[, around: any])

void Graphic.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Graphic.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Graphic.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Graphic.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem GraphicLine.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void GraphicLine.flipItem (given: Flip[, around: any])

void GraphicLine.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void GraphicLine.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any GraphicLine.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void GraphicLine.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem Group.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Group.flipItem (given: Flip[, around: any])

void Group.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Group.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Group.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Group.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem Image.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Image.flipItem (given: Flip[, around: any])

void Image.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Image.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Image.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Image.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem ImportedPage.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void ImportedPage.flipItem (given: Flip[, around: any])

void ImportedPage.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void ImportedPage.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any ImportedPage.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void ImportedPage.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

void LayoutWindow.select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE_WITH])

Asset Library.store (using: Array of any[, withProperties: Object])

void LibraryPanel.select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE_WITH])

void MasterSpread.createGuides ([numberOfRows: number=0][, numberOfColumns: number=0][, rowGutter: Measurement Unit (Number or String)=0][, columnGutter: Measurement Unit (Number or String)=0][, guideColor: any][, fitMargins: bool=false][, removeExisting: bool=false][, layer: Layer])

Swatch MixedInk.merge (with: any)

Swatch MixedInkGroup.merge (with: any)

MixedInk MixedInks.add (inkList: any, inkPercentages: Array of number[, withProperties: Object])

void Movie.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Movie.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem Oval.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Oval.flipItem (given: Flip[, around: any])

void Oval.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Oval.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Oval.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Oval.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem PDF.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void PDF.flipItem (given: Flip[, around: any])

void PDF.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void PDF.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any PDF.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void PDF.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem PICT.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void PICT.flipItem (given: Flip[, around: any])

void PICT.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void PICT.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any PICT.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void PICT.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

any Page.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

PageItem PageItem.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void PageItem.flipItem (given: Flip[, around: any])

void PageItem.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void PageItem.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any PageItem.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void PageItem.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem Polygon.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Polygon.flipItem (given: Flip[, around: any])

void Polygon.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Polygon.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Polygon.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Polygon.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

PageItem Rectangle.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void Rectangle.flipItem (given: Flip[, around: any])

void Rectangle.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Rectangle.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any Rectangle.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Rectangle.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

RuleDataObject RuleDataObjects.add (name: string, dataType: RuleDataType, dataValue: any[, withProperties: Object])

void Sound.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void Sound.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

void Spread.createGuides ([numberOfRows: number=0][, numberOfColumns: number=0][, rowGutter: Measurement Unit (Number or String)=0][, columnGutter: Measurement Unit (Number or String)=0][, guideColor: any][, fitMargins: bool=false][, removeExisting: bool=false][, layer: Layer])

any Spread.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void Spread.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

void StoryWindow.select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE_WITH])

Swatch Swatch.merge (with: any)

PageItem TextFrame.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void TextFrame.flipItem (given: Flip[, around: any])

void TextFrame.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void TextFrame.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any TextFrame.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void TextFrame.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

Swatch Tint.merge (with: any)

TransformationMatrix TransformationMatrices.add ([horizontalScaleFactor: number][, verticalScaleFactor: number][, clockwiseShearAngle: number][, counterclockwiseRotationAngle: number][, horizontalTranslation: number][, verticalTranslation: number][, matrixValues: Array of number][, matrixMapping: Array of any][, withProperties: Object])

PageItem WMF.duplicate ([to: any][, by: Array of Measurement Unit (Number or String)])

void WMF.flipItem (given: Flip[, around: any])

void WMF.move ([to: any][, by: Array of Measurement Unit (Number or String)])

void WMF.resize (in: any, from: any, by: ResizeMethods, values: Array of any[, resizeIndividually: bool=true][, consideringRulerUnits: bool=false])

any WMF.resolve (location: any, in: CoordinateSpaces[, consideringRulerUnits: bool=false])

void WMF.transform (in: CoordinateSpaces, from: any, withMatrix: any[, replacingCurrent: any][, consideringRulerUnits: bool=false])

void Window.select (selectableItems: any[, existingSelection: SelectionOptions=SelectionOptions.REPLACE_WITH])

array of XMLItem XMLElement.evaluateXPathExpression (using: string[, prefixMappingTable: Array of any])

XMLRuleProcessor XMLRuleProcessors.add (rulePaths: Array of string[, prefixMappingTable: Array of any][, withProperties: Object])

XMLTag XMLTags.add ([name: string][, tagColor: any][, withProperties: Object])

Return

Array Array.Array (length: number)

Array Array.concat (value: any)

Array Array.reverse ()

Array Array.slice ()

Array Array.splice (start: number[, num: number][, value: any])

Array Folder.getFiles (mask: any)

Array RegExp.exec (text: string)

Array String.match (regexp: RegExp)

Array XML.inScopeNamespaces ()

Array XML.namespaceDeclarations ()

Jongware, 20-Jun-2010 v3.0.3dContents :: Index