My LabelScripts folder is where I store scripts which, well, label things. The area of a path. The colors used in the artwork. The name and date of the file.

Link to zip archiveDownload The .zip Archive

Most of these scripts resulted from online discussions, and several are "spin-offs" from each other, exemplifiying how you can repurpose pieces of your Javascript for other needs.

Link to example image JET_AreaLabel.jsx
Creates a textFrame object that can be used as either just a reference and then deleted, or as a label in the drawing. This script returns an alert containing the area of the frontmost selected pathItem. The area is given in the five units of measure supported by Illustrator's rulers. A pointType textFrame object is created at the center of the pathItem's bounding box containing the text of the alert.

Select a path. Run the script. Delete, edit, and/or style the resulting textframe object as desired.


Link to example image JET_X_InkListSepLabels.jsx
In Illustrator's Print dialog, on the Marks And Bleeds pane, the Page Information option causes separation names to print in the bleed area. However, the sep names are printed in a horizontal row. In a document containing several spot colors (common in screen printing), the names of some seps fall beyond the bleed area and therefore do not appear on the printed seps. This script provides a workaround for that.

This script creates a set of stacked text labels at the lower left of the page, one for each ink in Illustrator's inkList. That means one for Process Cyan, Process Magenta, Process Yellow, and Process Black (whether they are used in the document or not), and one for each spot color used in the document. (Only spot colors used in the document are included in Illustrator's inkList. Therefore, labels are not created for any additional spot colors which may exist in the Swatches Palette, but which are not used.) The labels are created as PointType textframe objects offset from the left edge of the Artboard by the size of the label text, and offset from the bottom edge by half the size of the label text. The script provides a prompt to allow the user to choose the size of the label text.

With an Illustrator document open, select the script from the File>Scripts submenu. A prompt appears to allow you to set the size of the separation labels. Default is 9 pt. After clicking OK in the prompt, the stack of labels are created. If you want the labels to appear elsewhere, marquee select them and drag them. To distribute the labels, select the top one, ShiftDrag it horizontally to the right edge of the artboard. Then marquee select all the labels and use auto Distribute from the Align Panel.


Link to example image JET_X_InkListSepLabels_CUSTOMINKsOnly.jsx
This script is a variation of the JET_X_InkListSepLabels script. Because the InkLIst object in AI's Javascript implementation includes CMYK process inks, regardless of whether they are used in the document, the handling of those inks is removed from this simpler script. In other words, this script creates labels for only CUSTOMINKs (spot inks) actually used in the document. This script creates a set of stacked text labels at the lower left of the page, one for each ink in Illustrator's inkList with a inkInfo.kind of InkType.CUSTOMINK. That means one for each spot color used in the document. (Only spot colors used in the document are included in Illustrator's inkList. Therefore, labels are not created for any additional spot colors which may exist in the Swatches Palette, but which are not used.) The labels are created as PointType textframe objects offset from the left edge of the Artboard by the size of the label text, and offset from the bottom edge by half the size of the label text. The script provides a prompt to allow the user to choose the size of the label text. Line 40 sets a string variable to "Times-Roman". To change the font used, edit the text string. The value must be the accurate name of an installed font, or an error message will occur

 


Link to example image JET_InsertNameAndDate.jsx
This script adds the active document's file name and the current timestamp (date and time) at the text cursor position within a textframe object.

With an Illustrator document open, use the Text Tool to create a textframe object. This can be a textframe of any kind (PointType, AreaType, PathType). The text editing cursor (the blinking text "I-beam") must be active in the textframe. Run the script. The script inserts the document's name and the current date into the textframe.


Link to example image JET_NumberedCallouts.jsx
Creates a set of textFrame objects containing sequential numbers with an optional prefix. Also names each object (names appear in the Layers Panel) by the prefix and number. The naming portion of the script works on any object that can be duplicated. Therefore, the script can also be used to create and name a series of copies of any other type of object.

To Use: Select one object. Run the script.


Link to example image JET_SerialNumbers.jsx
Creates serial numbers within a selected text frame, incremented by one, with user-defined prefix, number of entries, and starting number. Numbers are separated by carriage returns. Useful for ticket-like number sequences.

To Use: Create a textframe object. This can be either PointType or AreaType. Select the textframe as an object. (Do not have the text edit cursor active inside it.) Then run the script. The content of the textframe is replaced by the serial numbers according to the parameters you specify in the prompts.


Link to example image JET_X_SwatchesLegend.jsx
Creates a series of labeled squares at the bottom left of the Artboard, each filled with one Swatch in the Swatches Panel. Useful for adding a "color legend" on pages of identity graphics, to specify colors. For each named Swatch in the Swatches Palette, the script draws a square filled with the Swatch color, and creates beside it a PointType object containing the name of the Swatch. The text labels are filled with Registration color. A prompt allows the user to set the desired size of the squares (in points). The label text size is 1/3 the size of the squares.

To Use: The script creates squares and labels for each swatch defined in the Swatches Panel, not just those used in the artwork. Therefore, before running the script, use the Add Used Colors command in the Swatches Panel flyout menu to make sure Swatches are defined for all used colors. Use Select All Unused and Delete Swatch commands to remove unused Swatches.


Link to example image JET_X_RenameRGBSwatchesToHex.jsx
Renames existing RGB Swatches in an RGB Color Mode Illustrator file to their hexidecimal equivalents. Useful when documenting colors in website mockups. First run this script to rename the RGB Swatches to hexidecimal values. Then follow with the JET_X_SwatchesLegend.jsx script, described above, to create an on-page color legend for the web site.

To Use: Be sure the current document is in RGB Color Mode. Otherwise, the script will merely alert you that the document is CMYK.