BLOG INDEX FOR 2016

It is amazing how fast a year can pass leaving one to wonder where did the time go! In anticipating a new year, we are left to evaluate time spent and think of ways that we can organize and optimize our efforts in the future. Certainly that is one reason that we spend a little time writing scripts; just to save minutes, and maybe hours, down the line.

For reference, we have indexed the blogs from 2016 below. Scripts are all written using AppleScript. When also written for ExtendScript, this is noted. Scripts are highlighted using boldface.

ALIGN and DISTRIBUTE

Automating Align and Distribute in InDesign – April 20
Distribute; Align; use distribute measurement; absolute distribute measurement, script preference measurement unit
key object; establishing selection key object
Resize and Distribute – ExtendScript

APPLESCRIPT TIPS and TRICKS

Custom Dialogs and Script Templates – February 9
customDialog(dialogName, favoriteList) – Dialog with fields for template name, document file, and favorite folder list
AddTemplate – Adds script as template to Script Editor Template folder
getFavoritePaths(arguments) – identifies path to each favorite folder listed

Automating Your Automation – February 16
New AppleScript Capability – New From Template
AppleScript Editor’s Script Folder; Script Menu; Creating Handler scripts
AddScriptTemplate() – tests for InDesign Templates folder in AppleScript Template folder; creates folder if not found
AddScriptTemplate_Choose() – Option for choosing a folder that exists or creating new folder
GetDocRef() – Example script template

Automating Your Automation II – February 23
Tools for Writing AppleScript Scripts
Add Handler Library to Favorites panel; Creating Handlers; Using saved handlers in script
getString(promptString, defaultAnswer, falseAsDefault) – sample handler for Handler Library
getSelected() – Returns list of selected page items
NameSelected – Names selected page items using custom dialog
getFileList_images(fileTypeList)
placeImages – using getFileList_images handler

Automating Your Automation III – March 1
AppleScript Library Options
Accessing Library folder: AppleScript’s Script folder, InDesign’s Users Script folder
Script Keyboard Shortcuts
AppleScript Menu
see October 8: Displaying Font Family Members
see December 14: Image Processing for Macintosh Users

DIALOGS – CUSTOM

Custom Dialogs and Script Templates – February 9
see User Interface Script – February 2
see customDialog(dialogName, favoriteList) – February 23
  Name Page Items – Fields for item base name, increment from.

DO SCRIPT

Working With Do Script – May 7
Selection Key Object
AlignToKey – ExtendScript
Call ExtendScript from AppleScript – DoScript
Do Script With a File
Alignment Options
Align_Options.jsx – ExtendScript

InDesign’s Do Script: Deeper Dive – May 25
DoScript with Arguments – simple AppleScript
Pass In Arguments – AppleScript, ExtendScript
Passing In File References

Adobe InDesign Do Script II – June 7
Working with DoScript
Passing arguments to Script – AppleScript, ExtendScript
Arguments Passed In and Returned – AppleScript, ExtendScript
Sort List – AppleScript using ExtendScript sort array method
User Choice – ExtendScript using AppleScript choose file

EMAIL CONTENT

Placing Mail Content In InDesign – July 8
Mail Scripts Folder – Apple
Get InDesign Insertion Point Reference
Extract Mail Message
Finished Script
  getSelectedEmail()
  placeMessageText(theText)
Delete Emails by Sender

EXCEL

Excel File to InDesign (Not Table) – July 25
Directory Text – AppleScript
placeText(insertRef, newText, paraStyleName)
readFile() – uses choose file
convertText (textStr) – Converts tabbed paragraphs into lists added to a master list
getSelected() – makes sure there is an insertion point active in document

IMAGES

Export and Crop Image – December 14
Image Processing for Macintosh Users
Image Events
Export Selected to PNG – AppleScript
Cropping Image using Image Events
Export Multiple Selected – export images
Script Menu

JUST FOR FUN

Seasons Greetings – December 11
Twelve Days of Christmas – AppleScript using say to read poem

PAGES

Adding Pages to InDesign Document – May 16

Add Pages – AppleScript, ExtendScript
Center Fold-Out – AppleScript, ExtendScript
Allow page shuffle, make page at end
Add Page – AppleScript, ExtendScript
Book Cover With Spine – AppleScript, ExtendScript
ResizeSpread – AppleScript, ExtendScript

PAGE ITEMS

Resize – April 13
Coordinate Spaces; Every; Repeat With
TestScript – Resizes selected using various coordinate spaces
  setMeasures(), resetMeasures(), getDocRef()

SELECTION

Key Object
see Automating Align and Distribute in InDesign – April 20
see Working With Do Script: Selection Key Object – May 7

SYSTEM EVENTS

seeTemplates and System Events – February 2
   exists file templatePath

TABLES

Styling Tables – January 5, 2016
TestTableStyle – dummy tab-return text used for table created and styled with table style created using cell styles
DocWithTableStyle – converts to table, make table style, merge, row type, applied table style, clear cell style overrides
PlaceAndStyleExcel –
  setExcelImportPrefs (rangeName, sheetName, optionSettings)
  chooseExcelForTable(defaultLocation)
  placeExcelFile(docRef, fileRef, tableStyleName, colWidth, rowHeight)

Importing Tables – January 12, 2016
Importing Tables, Cals Tables
ImportCALSTable – AppleScript, ExtendScript

Automating InDesign Tables – July 1
Merge Cells
Style Table – using styles in stylesheet
getUserChoice (choiceList, promptStr, allowMultiple) – returns user choice from choiceList
getTableFromSelection – Returns reference to table if cursor is in cell
Table Style – create table and style using table style, header row count, and body row count
Convert Text To Table

TEMPLATES

Templates – January 26, 2016
Alternate Template Path
Script (AppleScript) creates Template folder in Library folder
getTemplate() – January 20, 2016
Choose file() with default location

Templates and System Events – February 2
Save Template Script – step by step
User Interface – Demo dialog provides field for document name

see docFromTemplate (templatePath, doClose) – March 17
  opens template named and saves as document to path chosen

TEXT FILES

Plain Text Files for Automation – November 15
Read Text File as List
FindChangeByList
List Paragraphs from File
Make Book – Gets list of file names from getFileList handler for creating InDesign book.
  getFolderWithName(promptStr)
  getFileList (textFileName, folderStr)
  makeBook (folderStr, folderName, fileList)

TEXT FILES – THIRD PARTY

Google Docs to InDesign – August 16
Converting to Microsoft Word format for import to InDesign –
setMWordPrefs() – Setting Microsoft Word import preferences
PlaceImages.scpt – Uses tags in text flow for image placement – find grep
getStoryRef(docRef, minText, allowMultiple) – parses list of stories to get stories whose length is greater than 100

Microsoft Word or Google Docs – March 8
ImportMSWordFile
  chooseMSWordFile()
  mWordImportPrefs()
  placeFile(docRef, fileRef)
changeToBulletStyle()

Google Docs to Adobe InDesign – September 22
Cutting a long document into chapters using paragraph styling for chapter titles
getChapterList (docRef, paraStyleChoice, minLength, storyQuery)
getDocRef()
storyListTest(storyList, storyQuery)
makeChapters(docRef, storyRef, foundSet, chapterPath, templatPath)
trimText (thisString) – trims extra space, returns, tabs, and new lines from string end

TEXT FRAMES

Inline Text Frames – October 31
Sample Scripts – AppleScript, ExtendScript
Blank Paragraph for Placement – AppleScript, ExtendScript

TYPE FONTS

Displaying Font Family Members – October 8
Fonts in document list
Sample font styles for type family – AppleScript
Font Book – Font Book Script to display fonts in collections; requires TextEdit
  User chooses from list of Font Book collections
  Displays sample of text for fonts in collection in TextEdit
AppleScript Script Menu

XML

Importing and Styling XML – January 20, 2016
CreateDocImportXML – set import preferences and import
MapTags (docRef) – XML tag to style mapping
CreateAndStyleTable
  getXMLElement(rootElement, elementName)

Importing and styling XML II – January 26, 2016
Import XML With Tables – used document created with template having styes established.
getXMLElementList (rootElement, elementName) – returns list of references to XML elements at first level of root by name
mapTags (docRef) – XML tag to style mapping
ImportXMLasTable – Imports XML text to table with styling

Automating XML in InDesign – March 17
Introduction to XML
Create Document from Template
  xmlImportPrefs(doRepeat)-import preferences for merge import
  docFromTemplate (templatePath, doClose) – opens template named and saves as document to path chosen
  getPlacePoint()

Automating XML in InDesign II – March 23
PlaceXML_Story
  mapTags(docRef) – XML tag to style mapping
Setting Up Template; using autoflowing

Automating XML in InDesign III – March 29
Working with Autoflow – root XML element places XML using reference to story
Adding Images
loadXMLTags(docRef) – choose file checking name extension
Place XML_TextFrame
setImportPrefs(docRef)
getXMLFile()
see https://indd.adobe.com/view/05f652ba-6925-4ac2-ad3f-1046ee902173

Automating XML in InDesign IV – April 4
XML For Business – Business cards
Using master page for setup: Layer 1, Static, Dieline layers
DuplicateGrid – duplicates selected dieline rectangle 4 rows, 2 columns; use also for duplicating static text
LoadTags.scpt – Adding XML Tags
XML_Tag Markup.scpt
tagFrame(docRef, frameRef, tagName)
getTag(docRef, tagName)
Primary Grid script
Import To Root script
setImportPrefs(docRef)
getXMLFile()-choose file with extension test