Link any script into your menu

In my experience scripts are far more readily useable when they are available in the menu just like any other command. So far such luxury depends on the writer of the script.

Now every user of InDesign CS4 (or later) can decide for him- or herself if and which script should be linked into which menu.

Installation and concept

The Package contains two scripts and a folder of images

Put the script "loadScript2Menu.jsxbin" anywhere in your scripts panel folder along with the folder "ls2m_icons" and start it from your scripts panel (window > automation).

This script basically does nothing more than write a preferences file into your user folder. It does not change your menus.

The exact location of the preferences file depends on your platform:

  • Windows uses the environment variable %USERDATA% to define the user folder (by default: C:\\Documents and Settings\username\Application Data\cuppascript)
  • On Mac OS it's ~/Library/Application Suppor/cuppascript.

The script "loadScript2Menu_startup.jsx" does the actual extending of the menus. AFAIC the ideal moment for this is every time InDesign starts. For this put the script into the Startup Scripts folder in "<application folder>/Scripts/". If the Startup Scripts folder does not yet exist, create it.

Currently you need to restart InDesign to see any changes to the menus. I'll leave it for Version 2.0 to make this dynamic ;)

The Settings

"loadScript2Menu.jsxbin" calls this dialog:

The upper list displays the scripts you have installed so far, under which name they will be shown, where in the menu they are to inserted and whether there should be a separator line directly above it’s entry.

You work on this list using the seven icons on the right. The meaning of these is (in order):

  • Add script
  • Change script (e.g. when a new version of that script is available)
  • Duplicate entry
  • Delete entry
  • Change displayed name
  • Apply place in menu (from botton list)
  • Separator on/off

In case you do not find the icons obvious (probably) just click on the question mark.

The rest should be simple: click the top icon to add a script to the list. You are asked for the name to display in the menu.

Next look for the desired menu item in the bottom list and click the Apply button. Decide if you want a separator or not. Done. Either repeat for the next script or click OK and restart InDesign.

Some notes

When you apply a menu item to your script, the script’s entry will be inserted directly below that item. When you apply a menu or submenu, the script's entry will be added at the end of that menu.

The script was developed and tested on a german InDesign CS4. It should contain all translations into english and should display them automatically if you are not working on a german InDesign. I do not speak anything but German, English and Bad English, so if you are interested in supplying me with translations into any other language I'd be happy to add them.

AFAIK multicolumn lists (like the one with the script entries) are offered only since CS4. Apart from this (albeit fundamental) restriction it should work under CS3 as well. I do not know if and when I have time to fix the list for CS3 users. Until then it is CS4 only.

Comments

Script error

If I use the cript I get an error. I may do something wrong.
It starts to build the menu items and then returns with an error number: 509 Invalid image data.
Line: 455

invalid image error

>509 Invalid image data. Line: 455

The script is CS4 only. Are you using CS4?

Windows-Bug fixed

Under certain circumstances the script under Windows showed no files in the "Select a Script" dialog. I dropped the file-filter responsible.
Now the script should work fine under Windows.

Missing files

Hi Gerald - the zip file now only contains the script file, not the startup file and folder. I have tried it using the previous startup file & folder but there is still a problem. Scripts can be be selected but they don't appear to be saved. On an ID relaunch there are no new menu items, running the script again shows no menu items in the top box, and the file loadScriptToMenu.txt is empty,

Mick

Now including "move up" and "move down"

Peter Kahrel gave me a tip how to move list items at a reasonable expense. The package now contains version 1.0.1 including two new buttons :)