Scripts in InDesign
I'm a pretty advanced InDesign user, but have a FEAR and AVERSION to using and understanding Scripts. Can anyone recommend a link to something that is going to help me get over this hump? a "scripts in InDesign for dummies" sort of link that won't overwhelm me?!
Oh scripts are wonderful. They are tailored to a very specific use though. There are plenty of resources.
What is it you want to do with this script?
InDesign already comes bundled with a bunch of Scripts, go to Window>Utilities>Scripts (CS5) - for earlier versions go to Window>Automate Scripts
Here you have a bunch of scripts already. Like Make Grid.
Draw a rectangle on the page - then double click Make Grid and input your desired into the dialog box.
Hey Presto it's done.
If you right click or cmd click (pc/mac) then you can use the context menu that pops up to Reveal In Explorer.
Here you can load in whatever scripts you may find. Some come loaded into a browser like this one - http://in-tools.com/indesign/scripts/freeware/SeparatePages.jsx
All you need to do is copy the text to a Text Editor like Textwrangler or Notepad (not Word) and then save the file as SeparatePages.jsx
How to install scripts
http://indesignsecrets.com/how-to-install-scripts-in-indesign.php
There's a list of scripts here
http://www.kasyan.ho.com.ua/my_scripts.html
http://indiscripts.com/
http://www.indesigncentral.com/scripts.html
http://www.danrodney.com/scripts/
http://www.lynda.com/home/DisplayCourse.aspx?lpk2=46814 (video tutorials)
And i'm sure there are plenty of other resources out there.
Similar Messages
-
IDCS5-win. Error while running a script from indesign(not via estk)
Hi all,
After running the script from indesign, I get following error
ASSERT '(engine->getDebugFlags() & ScScript::kExtendedErrors) == ScScript::kExtendedErrors' in ..\..\..\source\components\script\javascript\JavaScriptRunner.cpp at line 412 failed.
..\..\..\source\components\script\javascript\JavaScriptRunner.cpp (412)
any idea about this?
The script runs fine when run from ES tool kit.
ThanksHi,
My colleague found the problem. We were using extendables library and we still haven't figured out what was actually happening, but removing it solved the problem. -
XSLT or Scripts (Mac -Indesign CS3)
Good Morning Everybody,
We are planning now to move our Journal (XML) production into Indesign CS3.
I've been successfully (though with limitations, as I am newbie in Indesign) implemented our books productions into Indesign CS2. This has been achieved thru using XSLT and Javascript expertise.
I've fair knowledge of XML features, like xpath, xslt, XSL, XSL:FO and Javascript though I still learning new things when it comes to use Javascripts in Indesign.
Well coming back to my query regarding Journals in Indesign, I am writing a style sheet, which transforms the xml input with all required formatting (paragraph, character styles), data manipulations, successfully inserting the punctuations specially in references, which can imported into INDCS2.
When it comes to informations like "Running Heads", "Journal informations, like volume, print issn, electronic issn" author infos in 2nd page onwards etc etc...In all these cases, I would prefer to use the XSLT (XML contains all these info) instead of scripts, simply because of reason, which I mentioned earlier that I am newbie in using Javascript in Indesign and there are may be some limitations of scripts in Indesign (Although thanks to Adobe for introducing XPath in CS3).
It was pretty easy for me to tackle/automate all these issues in other pagination platform (and the template was generic) using various scripts, XML features etc, but as I said we would also like to transit few of our journals into Indesign CS2/CS3
I've also tried to search the forum for possible answers but not very successfully. Can somebody suggest/guide how we should go about it? I don't mind to using scripts, if it is the best way of handling and developing a generic template. Or may be to look into other plug-ins, languages to make it successful.
Apology for writing such a long details but I thought I should made it clear what I am looking for.
Any help/guidance in this regard will be highly appreciated.
PankajHello,
I am just testing my "Subscribe to this discussion by email" settings...
Looking forward to hear from you soon......... -
Call Photoshop script from Indesign script CS4 JS
Hi, I open Photoshop linked file from InDesign in Photoshop and I need same InDesign script to run Photoshop script on the file. How I can call the Photoshop script from InDesign script.
Thank you very much for your help.
YuliaThank you, Kasyan.
800 lines of script is little be intimidating.
What we are trying to achieve is to open jpgs in Photoshop and resave them as tiffs and replace same jpg with corresponding tiff in Indesign as it was placed before.
Is there a way to call Photoshop from Indesign through appleScript.
I have most of the script done for Indesign and I have Photoshop shript ready that saves jpgs as tiffs done. I am only missing the part where I can call this existing Ph. script from Indisign.
We prefer not to use BridgeTalk if possible, because we have a lot of programs open and running in the same time, and would like to avoid to open one more program (BridgeTalk).
Thank you very much for your great help.
Yulia -
I have made .indd file with some form fields in it, now haw to read these fields and manipulate its content through script in indesign
It's probably best to ask in the InDesign Scripting forum:
InDesign Scripting -
Creating pdf with super/sub script using indesign
Hi,
I want to create a pdf with textrise for subscript and super script using indesign. I am new to this. Kindly guide me to acheive the same.
Regards,
Kameshwaran A.Hi Peter,
Thanks for the response. I have created the file in ID and exported / print (Both i have made) it to PDF. When i open the pdf and check the textrise value is 0. Actually it should be greater than or less than zero. I don't know what mistake i have made or how to acheive the same. Could you please tell me where i have made the mistake.
Thanks and Regards,
Kameshwaran A. -
Scripting Adobe inDesign CS?
Trying to sort out a couple of scripts to speed up my workflow in Adobe CS.
I use a lot of great Photoshop droplets and a couple of Illustrator actions (very unpredictable) and would like to automate a few things in inDesign.
Is there any way to record scripts for inDesign as is possible for Finder operations?
Anyone know of a good resource online for this. Preferably prewritten, editable scripts.
I would also like to ultimately set up hot folders that will run a series of processes when a file is added. i.e., Append file name, trigger a Photoshop action on file and then move to a print server.
Folder actions from Automator/Script editor are promising but a bit unpredictable. For example if one moves a Folder that has a designated action to a new location it reapplies the folder action to all files contained as path to that file has changed.
Any help appreciated, I don't have the time to trawl through pages of tutorials!You can access the InDesign Server COM object from Visual Basic in one of the following ways:
* CreateObject This points to a running instance of InDesign Server if it can find one; otherwise, it instantiates an instance of InDesign Server and points to the new instance. Example:
Dim idsApp As Object
idsApp = CreateObject("InDesignServer.Application.CS3")
* GetObject("name_of_configuration") This will attempt to point to the instance of InDesign Server that was started up with the corresponding "-configuration" param. If this instance does not
exist, an exception is thrown with the error: Cannot create ActiveX component. Example:
Dim idsApp As Object
idsApp = GetObject("hi")
* GetObject("configuration_portNum") This will try to point to the instance of InDesign Server that was started up with the corresponding -port param. If this instance does not exist, an exception is thrown with the error: Cannot create ActiveX component. Example:
Dim idsApp As Object
idsApp = GetObject("configuration_12345")
NOTE:
InDesign CS3 Server with MA updates applied is required in order to use GetObject() to target a specific instance of IDS. Also, you must run your VB application on the local system. IDS does not support targeting a specific instance of InDesign Server when running under IIS. Under IIS, you'll have to stick with the CreateObject() method. -
How Can I write Script for Indesign set left indent
I really need two scripts for indesign set left indent:
1. If the left indent is: 8, 16, 24, 32, 40, 48, 56mm... set the first -8mm; if the left indent is 0, set the left indent 8mm, first -8mm.
2. Whatever the first indent is, set the first 8mm.
Can someone help me?Hi, Trevor
I use change by list as below:
grep {leftIndent:48mm} {leftIndent:56mm}
grep {leftIndent:40mm} {leftIndent:48mm}
grep {leftIndent:32mm} {leftIndent:40mm}
grep {leftIndent:24mm} {leftIndent:32mm}
grep {leftIndent:16mm} {leftIndent:24mm}
grep {leftIndent:8mm} {leftIndent:16mm}
grep {firstLineIndent:8mm, leftIndent:48mm} {firstLineIndent:8mm, leftIndent:56mm}
grep {firstLineIndent:8mm, leftIndent:32mm} {firstLineIndent:8mm, leftIndent:48mm}
grep {firstLineIndent:8mm, leftIndent:24mm} {firstLineIndent:8mm, leftIndent:32mm}
grep {firstLineIndent:8mm, leftIndent:16mm} {firstLineIndent:8mm, leftIndent:24mm}
grep {firstLineIndent:8mm, leftIndent:8mm} {firstLineIndent:8mm, leftIndent:16mm}
grep {firstLineIndent:-8mm, leftIndent:48mm} {firstLineIndent:-8mm, leftIndent:56mm}
grep {firstLineIndent:-8mm, leftIndent:32mm} {firstLineIndent:-8mm, leftIndent:48mm}
grep {firstLineIndent:-8mm, leftIndent:24mm} {firstLineIndent:-8mm, leftIndent:32mm}
grep {firstLineIndent:-8mm, leftIndent:16mm} {firstLineIndent:-8mm, leftIndent:24mm}
grep {firstLineIndent:-8mm, leftIndent:8mm} {firstLineIndent:-8mm, leftIndent:16mm}
but not that perfect,
I want to useing jave "if{}" or "for{}" to write this script, but I don't kown the syntext. -
Change permission file pdf in script jsx indesign cs6
change permission file pdf in script jsx indesign cs6
What exactly is the question? If you are looking for help with a script, please post in InDesign Scripting
-
Using CS2 script in Indesign CS4
Hello,
I am very sorry if this point has been already treated but I have not yet found the solution.
I have Applescripts running on CS2, and I would like that these scripts could work either under CS2 and CS4 without any change
I know there is a possibility of choosing the version but I can't find the code corresponding to applescript.
Anymore I would be happy to find the applescript reference for Indesign CS4
Thank you for your help
JeanPlease move this thread to Indesign forum, http://forums.adobe.com/community/indesign.
-
Hai all,
i am trying to insert footnote and its contents for a particular xml element in "Adobe Indesign cs2" thru apple script. But i'm facing some problem. I'm able to select the xml element and its contents and i can insert footnote for that element and i can cut that contents but i couldn't paste this contents in footnote. I have tried with the following code:
tell application "Adobe InDesign CS2"
tell active document
set theRoot to (item 1 of XML elements)
end tell
end tell
myLoopLoop(theRoot)
property myLoLoV : {}
property myHoHoV : {}
on myLoopLoop(myElement)
tell application "Adobe InDesign CS2"
tell active document
set moreElement to every XML element of myElement
repeat with x from 1 to (count of moreElement)
set em1 to item x of moreElement
select em1
if (name of markup tag of em1 is "informalexample") then
set em2 to em1
select text of em2
tell insertion point 1 of em1
set myfootnote to make footnote
end tell
tell application "Adobe InDesign CS2"
set myselection to selection
cut (selection of active document)
end tell
tell application "Adobe InDesign CS2"
tell insertion point 1 of myfootnote
paste into myfootnote
set text of em2 to myfootnote
end tell
end tell
end if
tell me to myLoopLoop(item x of moreElement)
end repeat
end tell
end tell
end myLoopLoop
Can anyone help me out to sort this problem?
Thanks
anbu
I Mac Mac OS X (10.4.8) Intel based Machi all
any help
thanks
anbu -
Script for InDesign CS6 - create multiple, prenamed layers
I created a script for Illustrator CS6, in ExtendScript Toolkit, that will create multiple, prenamed layers...see below...
//Apply to myDoc the active document
var layerName = LayerOrderType;
var myDoc = app.activeDocument;
//define first character and how many layers do you need
var layerName
var numberOfLayers=0;
//Create the layers
for(var i=0; i<=numberOfLayers; i++)
{ var layerName = ":: GRADIENT"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: STRIPES"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: LEGAL"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: BLK BAR"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: FLAME"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: LOGO/TYPE"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: TRIM,ETC"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
{ var layerName = ":: LOEC INFO"; var myLayer = myDoc.layers.add(); myLayer.name = layerName; }
// Moves the bottom layer to become the topmost layer
if (documents.length > 0) {
countOfLayers = activeDocument.layers.length;
if (countOfLayers > 1) {
bottomLayer = activeDocument.layers[countOfLayers-1];
bottomLayer.zOrder(ZOrderMethod.BRINGTOFRONT);
else {
alert("The active document only has only 1 layer")
I tried to use this exact code to replicate the same scenario in InDesign but it doesn't work.
Can anybody help me out!?
Thanks in advanceMarijan Tompa's scripts are very nice and useful, however, for this simple task you can try create your own wiht this code:
app.activeDocument.layers.add ({name: "GRADIENT", layerColor: UIColors.red});
app.activeDocument.layers.add ({name: "STRIPES", layerColor: UIColors.lightBlue});
app.activeDocument.layers.add ({name: "LEGAL", layerColor: UIColors.gray});
//merge existing document layer to bottom layer (in this case original layer will be merged to 'GRADIENT')
var myDocument = app.documents.item(0);
var myLayerA = myDocument.layers.item(2);
var myLayerB = myDocument.layers.item(3);
myLayerA.merge(myLayerB);
alert("Layers created!");
assume, your document has one layer.
Script creates three new layers, they appear in Scripts palette in this order:
LEGAL
STRIPES
GRADIENT
and merges 'old' layer to bottom layer of newly created set (GRADIENT).
sure, you can add as much layers as you need, just don't forget modify LayerA and LayerB numbers accordingly.
Or disable second part of the script at all, if you don't want anything to be merged. -
Is there an updatedcrossrefs script for InDesign CS6
Running Mac Pro/2.66 GHz—Quad-Core Intel Xeon/Snow Leopard/
OS/Mac OS X Version 10.6.2/2.66 GHz
I converted a CS3 InDesign that uses the script "updatedcrossrefs.js", to CS6 InDesign. This file uses hyperlinks on the TOC and Index.
I tried using the same script for CS3 InDesign in CS6 InDesign but it does not work.
This is the error message "Could not catch page. Check destination names and existence."
Is there an updated script for CS6?Sorry did not know I was using bold. My co-worker found this script however, she does not work here anymore. But here is the script. I know nothing about scripts except how to use them. Sorry.
// Updatecrossrefs.js
// Updates cross references made with hyperlinks
// the hyperlink destination is where the reference refers to
// the hyperlink sourcetext is the text that will be updated (like see xx)
// If a book is open, the book will be handled,
// if no book is open, the active document will be handled.
// Made by Teus de Jong, last version April 10, 2006
// Revisions by Dave Saunders January 22, 2006 and March 20, 2006
// Thanks Dave!
// Added unique naming mechanism for sources -- October, 2008
if (app.books.length == 0){
if (app.documents.length == 0){
errorExit('No documents are open');
} else {
nrofdocs = 1;
doc = app.activeDocument;
} else {
nrofdocs = app.books[0].bookContents.length;
for (i = nrofdocs - 1; i > -1; i--) {
if (app.books[0].bookContents[i].status != BookContentStatus.documentIsOpen)
app.open(File(app.books[0].bookContents[i].fullName));
doc = app.open(app.books[0].bookContents[0].fullName);
for (d = 1; d <= nrofdocs; d++){
for (i = 0; i < doc.hyperlinks.length; i++){
hyper = doc.hyperlinks[i];
// leave ID's own internal markers alone
if (hyper.name.substring(0, 1) == '.'){continue}
// leave hyperlinks to URLs alone
try {
if (hyper.destination.constructor.name == 'HyperlinkURLDestination'){continue}
} catch (e) {
hyper.showSource();
errorExit('Selected hyperlink has undefined destination');
s = hyper.source.name;
// added October, 2008
// sometimes ID's unique name mechanism for sources fails; make sure the source has
// the same name as the hyperlink + '_src'
if (s != hyper.name + '_src')
hyper.source.name = hyper.name + '_src';
if (hyper.destination.constructor.name == 'HyperlinkTextDestination'){
s = getParentPageName(hyper.destination.destinationText);
} else {
// try/catch added to allow for hyperlinks that have lost their destination -- Dave
try {
s = hyper.destination.destinationPage.name;
} catch (e) { continue }
if (s != ''){
// Check to see if update needed; saves a lot of time when processing large books -- Dave
if (hyper.source.sourceText.contents != s) {
hyper.source.sourceText.contents = s;
if (d >= nrofdocs){
break;
doc = app.open(app.books[0].bookContents[d].fullName);
function getParentPageName(txt){
try {
var myFrame = getParentTextFrame(txt);
var pag = myFrame.parent;
while (pag.constructor.name != 'Page'){
// in case the reference is in an inline, the parent of the frame is a character
if (pag.constructor.name == 'Character'){
pag = getParentTextFrame(pag);
// in case the chain goes sour, back out
if (pag.constructor.name == 'Application'){
throw 'Error';
pag = pag.parent;
return(pag.name);
catch (e) {
alert('Could not catch page.\nCheck destination names and existence.');
return('');
function getParentTextFrame(x){
if(app.version == 3){
return(x.parentTextFrame);
else {
return(x.parentTextFrames[0]);
function errorExit(s){
alert(s);
exit(); -
Creating a TOC via script on InDesign Server [CS5.5]
I have been struggling for about two weeks with trying to figure out how to script the creation of a TOC and an index for a book. I've successfully created the book, and have also been able to create the table of contents, however I cannot place the contents in the book. From the UI it's simple because it loads up the cursor with the TOC contents. But in script, it simply provides an array with a single Story object.
I have no idea how to make the story appear in my document. Here's my current code:
var book = app.open("book.indb");
var doc = app.open("table_of_contents.indd");
var tocStyle = doc.tocStyles.firstItem();
var stories = doc.createTOC(tocStyle, true, book, ["1in", "1in"], false, doc.layers.firstItem());
When I hit that final line, I get the following error:
Invalid value for parameter 'destinationLayer' of method 'createTOC'. Expected Layer, but received Layer.
Okay... so, if it's expecting a Layer and I'm providing a Layer - what gives?
Originally I had figured that I:
Had to create a TOC document from a template which contains a single text frame that automatically flows from page-to-page (using a master)
Add the document to the book at the beginning
Copy the contents of the Story into the TextFrame
Iterate the Lines collection of the Story, copying the paragraph and character styles for each line
This works, but it's no longer a TOCStory type. I would like to maintain the TOCStory type and just have the content flowed into the new document which I add. This makes sense, logically, but I know that nothing in InDesign is really that logical. It seems to be a lot of collection manipulations, but I cannot figure out which collections to manipulate.
The Index.generate() method seems so much more logical because the first argument is where to place the content. If it were only that simple for the TOC! If you've had experience doing this, please let me in on the secret... I don't have access to the menu items so I cannot invoke actions. Those threads don't seem to apply for InDesign Server (and that makes sense, since it's headless)
Thanks,
- BrettHi Brett,
here is the code that worked for me.
Michael
var bk=app.books.add(File("C:/Users/wwadmin/Desktop/testbook.indb"));
for(i=0; i<5; i++){
var doc=app.documents.add()
var page=doc.pages.firstItem()
var frame=page.textFrames.add({geometricBounds:[0,0,'10in','10in']})
frame.contents="Hello World!!!!!";
var style=doc.paragraphStyles.add({name:"Body"});
frame.paragraphs.firstItem().appliedParagraphStyle=style;
doc.save(new File("C:/Users/wwadmin/Desktop/doc"+i+".indd"))
bk.bookContents.add(File("C:/Users/wwadmin/Desktop/doc"+i+".indd"));
var doc=app.documents.add();
var page=doc.pages.firstItem();
style=doc.paragraphStyles.add({name:"Body"})
tocstyle=doc.tocStyles.add({name:"myStyle"});
tocstyle.tocStyleEntries.add({formatStyle:style, name:style.name});
doc.save(new File("C:/Users/wwadmin/Desktop/test.indd"))
bk.bookContents.add(File("C:/Users/wwadmin/Desktop/test.indd"));
doc.createTOC(tocstyle, true, bk, undefined, true, doc.layers.firstItem())
bk.save()
for(a=app.documents.length-1; a>(-1); a--){
app.documents[a].save(File(app.documents[a].fullName));
app.documents[a].close();
bk.close() -
Couldn't create a postscript file for the devnagri script from indesign
Hi,
Couldn't create the postscript file for the indesign devnagri script. Its throughing error saying offending fonts.
I have added a link where u can download the rar file which contains indesign file and required fonts.
http://wikisend.com/download/278714/Devnagri Script.rar@Raghugada – I tested with your new font (no license restriction) and could print to PostScript and distill to PDF without problems. Something else is wrong on your side. Could you provide an IDML file instead of the inDesign file? I will test this as well.
And: How do you print to PostScript?
Do you do it with the right PPD? The "Adobe PDF 9.0" ? (PPD => PostScript Printer Description File)
Do you do it with the right setting in the print dialog of InDesign?
PostScript Level 3, binary, all fonts fully embedded?
Here a screenshot of a sample PDF from Acrobat Pro with SHREE-DEV-7-0715 font:
Uwe
Maybe you are looking for
-
How can I retrieve data from one table to another automatic in SQL?
Hi, everione, I am having a big problem, trying to create datebase. I have 3 tables: SUPERAVATAR, MASTERAVATAR, MEGAAVATAR. - SuperAvatars are heroes in an online role playing gaming. They have an ID, superavatarID which contain an UNIQUE NUMBER NO
-
Obviously I do not want to have to resubscribe to Podcasts (though it wouldn't be TOO much of a hassle) or reupload all my music/CDs (rather more of a hassle) if I can help it. If anyone knows whether I can get away without having to reupload everyth
-
InDesign CS6 and CC hang constantly in Windows 8 x64
Id anyone else experiencing a similar problem? If I do anything at all in InDesign, the application will "hang". I can still move my cursor, it does not crash, I can still see what text block or other item I have selected, but I can't do anything at
-
IOS 8.1.3 photos problem
when open photos in my iphone 6 plus after the last update the phone stop working unless i restart it pls help
-
Mac shortcuts (OSX Yosemite) stop working after Edge Animate runs for a while
When I first open up an Edge animation file all my shortcuts work fine, such as Command-S to save. After the software has been running for a while all my OSX shortcuts stop working and I have to copy, paste and save from the File menu instead. When I