is now part of CreativePro.com!

How to Install a Script in InDesign That You Found in a Forum or Blog Post

26

This has bugged novice InDesign users for years: You find a script on a forum thread or a blog post, but it’s just text… that is the scripter has pasted the text of the script in, so you can actually see the code. For experienced users (and scripters), that’s no big deal. But if you want to use that script, but you don’t know what to do with the code, read on.

By the way, if you find a script and can download it (it’s a downloadable .jsx or .zip file) then you need to read this other blog post about how to install it. Also, in the vast majority of cases the code you find will be written in javascript (technically called “extendscript”). However, if you think it’s AppleScript or VBscript, then these instructions will not work. We’ll try to do another blog post about those some other time.

Okay, you see a bunch of code and you want to run it in InDesign.

1. Copy the Script. You need to copy the text. On some web pages, there will be a “Select Code” button for your convenience (just click it and it selects all the code). Otherwise, just drag over the code text and copy it to the clipboard. Make sure you get it all — dropping even a single character can often mean the difference between success and failure.

Copying a Script

2. Paste the Script. You need to save the script into a text-only file. You could paste the code into the Adobe Extendscript Toolkit application, but that’s overkill unless you’re planning on doing scripting yourself. Instead, paste it into a text-editor, such as TextWrangler (my favorite free text editor for the Mac), or TextEdit, or NotePad on Windows. Just make sure that you’re in text-only mode, so there’s no formatting (font, styles, and so on).

Pasting a Script

3. Save the Script. When you save the script to disk, it must have a .jsx file name extension (not .txt). You can save it to disk anywhere you want, such as the Desktop, My Documents, or some other folder.

4. Move the Script into Position. In order for InDesign to see and use the script, it has to be in one of two places. To find that “right place,” switch back to InDesign temporarily and open the Scripts panel (it’ll be in the Window menu; in CS5 or later, it’s tucked in the Utilities submenu). You’ll see two folders listed in the Script panel: Application and User. I almost always store my scripts in the User folder because they’re “my” scripts. So right-click (or Control-click with a one-button mouse) on the User folder and choose Reveal in Finder from the Context menu (or Reveal in Explorer in Window). That opens a folder on your desktop in which you’ll find a folder called Scripts Panel. Move your script into the Scripts Panel folder. Any script inside the Scripts Panel folder will appear in the Scripts panel.

Reveal Script panel

5. Run the Script. That’s it! Now you can switch back to InDesign and you should see your newly-saved script inside the User folder. (You may have to click the expanding triangle next to the folder name to see it.) You can run it by double-clicking it.

If the script doesn’t work for some reason, go back to the file and:

  • make sure it’s truly a text-only file
  • make sure any quotation marks (single or double) are straight quotes and haven’t accidentally been turned to curly quotes
  • make sure you copied all the script properly
  • make sure you’re running the script properly (for example, some scripts require a frame to be selected before they do anything; others need a document open, or no documents open, and so on).
  • in some cases, part of the script will have been messed up by the web site formatting. For example, some characters may have been munged, deleted, or changed in the HTML. In this case, there’s little you can do except see if someone has commented on a fix (check the original web site for comments), or contact the script writer. Posting scripts can be a tricky business because each and every character counts!

Hey, Anne-Marie Concepcion also showed how to do this (with even more details) in her InDesign Secrets video “Running a Script” at lynda.com!

David Blatner is the co-founder of the Creative Publishing Network, InDesign Magazine, CreativePro Magazine, and the author or co-author of 15 books, including Real World InDesign. His InDesign videos at LinkedIn Learning (Lynda.com) are among the most watched InDesign training in the world.
You can find more about David at 63p.com

Follow on LinkedIn here
  • Stéphane B. says:

    In an other way, you also could use “Script Bay” to test and save the script.
    https://in-tools.com/article/script-bay/script-bay-version-0-1-5/

    Using the “Script Bay with Editor” configuration (last screenshot), you could paste the script, test it and name it directly inside InDesign (or PS, AI?) without having to find the exact folder location and without restarting InDesign:
    https://in-tools.com/article/script-bay/script-panel-replacement-for-the-entire-creative-suite/

  • Marc Autret says:

    Hi David ;-)

    Thanks to mention that small snippet as an example. Unfortunately?I am ashamed!?there was a typo in my script, so there is a typo in your screenshot.

    We should replace

    doc.facingPages &&
    . . .

    by

    dpf.facingPages &&
    . . .

    Sorry about that.

    @+
    Marc

  • @Stéphane: Excellent point! Thank you!

    @Marc: No problem. It is fixed in that other blog post where you typed it.

  • John Hawkinson says:

    Hey, guys. Thanks for the reprise of indesignsecrets.com/how-to-install-scripts-in-indesign.php. This one is better done!

    But I’m afraid I think Dan Rodney still did a better job with http://www.danrodney.com/scripts/directions-installingscripts.html. Those inline images make all the difference! Consider cribbing :)

    I want one good URL to point people to!

  • Magne Hjertaker says:

    Great article! Didn’t know this was so easy. Thank you!

  • Marcel says:

    Step 0 is to read other peoples comments and al least skim read the script itself . Remember ExtendScript can access your filesystem, download from internet or send anything out to internet, thus capable of anything rangigng from innocent pranks to nasty stuff.

    Speaking of scripts, here’s one that alows you to downsave to lower version, allows footnotes work with tables, walks your dog every morning and cook you breakfast.
    You may try it yourself. Only don’t forget to apply step 0 I suggested

    Marcel

    [[editor’s note: we removed this dangerous script. @marcel: while you make a very good point (that you should know what a script does, trust the scripter, and read all comments before you blindly run it), there’s no reason to actually provide a script that will cause damage here.]]

  • Jongware says:

    Yeah … Marcel, your advice of “applying step 0” will only work for those who know both Javascript and AppleScript, and who know what the shell does in Mac OS X, and who know what the “rm” command does. Everyone else that tries it just to see what happens will encounter a Very Nasty Surprise of the Serious Kind.

    Do Not Try Marcel’s Script For Fun. Don’t. Don’t. Don’t.

    (See wikipedia on “rm -rf” for what this command would do!)

  • I would also mention Notepad++ as a good and free text-editor for Windows.

  • @Jongware: Thanks for the heads up on that script. It’s gone now. I have actually never seen a scripter in the InDesign community post a dangerous script like that, but I suppose one must be careful — scripts are software, and though they usually only control InDesign (in this case), they can potentially reach out farther, especially when calling AppleScript or VBScripts.

  • Jongware says:

    .. they usually only control InDesign (in this case) ..
    David, not in this case. This script would have executed an OS shell command that removes every file on every storage unit within its reach in your entire system (i.e., connected back up disks, floppy disks, network drives, USB sticks, etc.).

    Sorry Marcel, I’m quite certain you purely meant to joke, but I’m equally certain it would have been no laughing matter for some.

  • @Jongware: Sorry, I was not clear with my comment. Yes, I understood that this javascript would run an applescript. I meant that it’s very rare to see javascript (extendscript) scripts on forums or blog posts like this that trigger applescripts or other scripts.

    For anyone reading this who is nervous about scripts, I think the lesson from Marcel is: “if you’re unsure about a script, then wait to see when someone responds to the script saying ‘this is great!’ ” :)

  • Marcel says:

    I probably shouldn’t have posted that snipped here, athough it had a safety brake and would crash before doing any harm on anyone’s but my own system (missing library).

    I wanted it to illustrate that you can spot suspicious code even without scriping knowledge.
    If the script promises to cook you breakfast and there’s nothing of the sort in it then it’s suspcious.
    Anything like “app.doScript” or “Socket” in standalone downloaded script can mean it’s a malicious script.

    other signs of malicious scripts (on top of ‘Socket’ & ‘app.doScript’):
    huge dense block of text
    any ocurence of “eval” especialy something like eval(‘LONGNONSENSICALLMUMBOJUMBOSPANN1NGC0UPL3OFLIn3S’)

    But Scripts don’t have to be malicious to cause damage. Simple app.save() after some error in the middle of the script run on the original document can ruin your day/job position.

  • @Marcel: True enough! It’s good to be safe.

    But I just want to reiterate (for everyone else reading this) that in many years I have never run into an InDesign script offered by a reputable person that causes significant damage. Sometimes they don’t work and need debugging, but that’s not terrible.

    That said, it is a Very Good Idea to save your documents often, make backups from time to time, and perhaps even save your file before running a script.

  • Heather says:

    Upgraded InDesign CS6 from Adobe Cloud, and it appeared to pull scripts from previous versions. In my Finder my script appear to be there, but does not show up in my Script Window users folder.
    When it runs in Script Toolkit, it errors on

    /*void*/ LayoutWindow.prototype.permuteSelected = function()

    saying “LayoutWindow is undefined”.

    It shows up in the proper place – User/Library/Pref/Adobe InDesign/Scripts Panel
    but does not show in my users folder in script window.
    I don’t write scripts, so have no idea where to fix. I have fallen in love with this script, and really would love to have it back in my daily workflow.
    Any help would be appreciated.

  • Denise says:

    THANK YOU! This was exactly what I needed. So appreciated.

  • Dan says:

    Woohoo! Thanks! I was really lost.

  • VC says:

    This is my first experience with InDesign and my first attempt at using a script. Can anyone tell me how much of the JSX text to keep in the file? I found a MOO Script for making MOO Cards in InDesign. I haven’t figured out how to get it to run and MOO said maybe Adobe can help. I see now that my downloaded file was converted to moo.jsx.txt so I just changed it to moo.jsx
    Here is the link for the jsx file which MOO links to:
    https://raw.github.com/moodev/moo-indesign/master/moo.jsx
    The script has a Header of sorts – which begins with a long line of dots (below). After that it starts with “#target indesign”. Where does the actual script begin??? and should the whole thing stay in the jsx file after downloading? Sorry – I’m a newbie, but want to get this working.

    //———————————————————*- javascript -*—-
    //
    // moo.jsx
    //
    // an InDesign script to assist in the creation of MOO Business Cards
    //
    // (c) MOO Print Ltd 2012
    //
    //—————————————————————————–
    //
    // includes the following third-party libraries (see below for licences):
    //
    // OAuth (c) Netflix, Inc. 2008
    // SHA (c) Brian Turek 2008-2010
    // JSON Douglas Crockford (Public Domain)
    //
    //—————————————————————————–

    #target indesign
    #targetengine ‘session’

    (function() {
    var API_HOST = ‘uk.moo.com’;

  • Joris says:

    Sorry to bother you this late, but I’ve a problem. Similarly to what Heather reports, the scripts aren’t showing up in my Scripts panel.
    – They don’t show up immediately like they should.
    – They don’t show up after a reboot.
    – They don’t show up after deleting the preferences.
    – Tried three different scripts. No errors when I open them with the Extendscript Toolkit. They have the right file extension as well. All scripts should work with my version of InDesign.
    – The pre-installed scripts show up just fine, doesn’t appear to be a graphics problem.
    – I’m using InDesign CS5.5 (7.5.3) on Windows 7 Pro. It’s a shared computer with password-protected accounts, but I don’t see any restrictions in using or configuring it.

    Anybody know what I’m doing wrong here?

    • Joris: I’m guessing that you are putting them in the wrong folder. For example, if you have more than one version of InDesign installed, there will be more than one Scripts Panel folder. Try the Reveal in Finder/Explorer trick explained in the article above to ensure you have the right one. Also, ensure that the scripts go into the Scripts Panel folder, not the Scripts panel.

      • Joris says:

        Hi David,
        Yes, I used the ‘Reveal in Explorer’ from the Scripts panel way. But I completely overlooked the repeated instruction to put it into the SCRIPTS PANEL FOLDER. Apparently my expectation to immediately get to the right folder when right-clicking has made me lazy.

        In short: you’re right! Seems okay now. Thanks for the quick reaction!

  • Jeremy says:

    I absolutely love this script, I added pages above each calendar page to make a photo calendar, my ONLY question, is now for next year, how do I just change the dates, without having to go back and do all the work of adding the pages, sizing the images, etc. Thank you!

  • Jenn says:

    undefined is not an object error in my first line

  • jordan 11 says:

    Excellent job about this write-up! I especially like the way you presented your information and also the way an individual got crucial and also obvious to recognise. Thank you so much much.

  • Anderson says:

    I knoοw tthis web site preѕents quality depending articlеs and additional stuff, is theree any otеr website which preѕents such stuff
    inn quality?

  • >