A simple script to open, make a change, save and close files. Generally used with InDesign files.
This script is meant to do just what the name says, that is Open, Change, Save and Close files. Generally the script is used in cases where a InCopy file no longer has a preview due to a data migration. Opening the layout, making a change and saving the file will address that issue. Doing that manually for hundreds of files is not fun. Hence the creation of this script.
The files that the script does these actions to are found in Studio via a query that is created and then saved by a user in the InDesign/InCopy client. The script will use that query to find the objects to operate on and then run through opening, making a small change, removing that change and then saving and closing each of the objects.
At the top of the script there are three settings:
applicationName = "InDesign"; This refers to the name of the application you want to use to open the file. This setting can be either 'InDesign' or 'InCopy'.
articleQueryName = "Layouts"; This is the name of the query that the script will use to perform a search in Studio. The name here in the configuration simply has to match the name that saved the query under.
newRouteTo = "WoodWing"; The script has the ability to change metadata. In general I was using the 'RouteTo' value so that the changed files would be available to me without searching. Makes testing easier.
The code for this section is commented out so the 'RouteTo' value will not be changed.
Save your file.
The script needs to be installed into the application you are going to use to open the files. In this case we'll describe InDesign. After you have reviewed the configuration options, save and close the javascript file and take the following steps:
- Find your Adobe InDesign Application folder
- Open the folder and find the 'Scripts' folder. Open it and find the 'Scripts Panel' folder. Open it.
- Move the script file into the 'Scripts Panel' folder
- Start InDesign or, if you have InDesign running, go to the application( you don't have to restart InDesign to see the script in the panel)
- Select 'Window > Utilities > Scripts
- The script will be visible in the panel.
A query needs to be created and saved. The name of the query needs to match the configuration value for 'articleQueryName'. It's best to include the 'Type' value in the query to make sure you are getting the files you want. See below for a screen shot of sample query.
OpenSaveChangeClose.mp4
- Be sure to modify the 'queryName' variable to match the user query created
- This is script is not smart enough to identify the object type from the query so be sure to set the 'applicationName' variable and then set the saved user query to find just the appropriate objects (i.e. for instance add 'Type' = 'Layouts' to the query)