Xmarks Top Site in Adobe Scripting


Archive for the ‘InDesign’ Category

InDesign ExtendScript Toolkit and Soxy

Wednesday, January 27th, 2010

If you design and create ExtendScripts targeting Adobe InDesign for other people, like we often do, you probably also need Soxy.

Our customers use a diverse range of InDesign versions (CS, CS2, CS3, CS4), so we need to make sure the custom scripts we develop are tested against the same version of InDesign as the customer’s.

So, if my customer uses, say, CS2, I’ll use InDesign CS2 to test my script before e-mailing it off to the customer. (Of course, I could use InDesign CS4, and make InDesign CS4 switch to the CS2 script object model, but I rather play it safe, and test the script in the same environment as my customer).

During these tests, I often have the need to debug the script – so I need to use ExtendScript Toolkit.

The problem is somewhat convoluted, but very annoying.

First of all, I have multiple copies of the ExtendScript Toolkit on my computer. There is ExtendScript Toolkit (goes with CS2), ExtendScript Toolkit v2 (goes with CS3), and ExtendScript Toolkit CS4.

When I want to test a script in InDesign CS2, I first make sure it resides in the appropriate InDesign scripts folder.

Then, when I see the script appear on the Scripts Palette (oops *) Panel, I’d love to right-click the script and select Edit Script from the context menu.

Here’s where it goes wrong if you don’t have Soxy: when you select that Edit Script menu item, one of the three installed copies of ExtendScript Toolkit will ‘grab’ the script – and it’s often the wrong one.

So, you need to quit the wrong ESTK, then manually launch the version of ESTK that is associated with the version of InDesign you’re using, and then File – Open… the script from there. Or alternatively, you need to drag your script onto the appropriate ExtendScript Toolkit icon. Not exactly straightforward – it’s what I call an ‘aaargh’ moment.

Thanks to Soxy, you can forget all that – simply set up Soxy to handle .jsx files, and to pick the proper copy of ExtendScript Toolkit. So, when you’re slaving away on an InDesign CS2 script, you can simply right-click the script name, and select Edit Script. The script will be opened by Soxy, Soxy checks which Scripts Panel folder the script resides in (CS2, CS3 or CS4?) and immediately forwards the script to the proper version of ExtendScript Toolkit. It’s all but invisible – and no more ‘aaargh’!

So, next time you need to debug an InDesign CS2 ExtendScript – give Soxy a try! More info and a fully functional, time limited demo can be found here:

http://www.rorohiko.com/wordpress/downloads/lightning-brain-soxy/

* Footnote: Click here to see what the Palette Panel  ’oops’ is about ;-)

Workshop – Getting Started With The InDesign SDK

Wednesday, January 20th, 2010

If you’re involved in automation around the Adobe Creative Suite, you need to mark the week of May 3 to May 7, 2010 on your calendar – there’s another Adobe Creative Suite Developer Summit (aka CSBU Developer Summit) coming up in Seattle, at the Adobe Fremont Campus.

For the third year in a row, we’ll be running our acclaimed Getting Started With The InDesign SDK workshop during the summit – click this link for more info:

http://www.rorohiko.com/wordpress/workshop-getting-started-with-the-indesign-sdk/

Familiarizing yourself with the InDesign SDK takes many months of hard work and study. This workshop will slash a substantial amount from the time it takes to gain a good understanding and get properly started. Make sure you enroll as soon as possible – there is only room for 12 participants!

More about the Adobe Creative Suite Developer Summit can be found here:

http://www.adobe.com/go/2010csbuDevSummit/

Soxy 1.0.7 is now available for Mac OS X

Wednesday, January 13th, 2010

We have added a new feature to help work around a Finder issue in Mac OS X Snow Leopard which occurs when you double-click an InDesign document that has a ‘#’ character in its name.

Read more about it on the Adobe forums by clicking here

Download our latest version of Soxy:

http://www.rorohiko.com/soxy/

TextExporter 2.1.3 Available

Sunday, January 3rd, 2010

TextExporter is a plug-in for InDesign CS, CS2, CS3 or CS4. It allows you to export all the text from an InDesign document concatenated into a single RTF file, while following a natural reading order. Text files and InDesign Tagged Text are also supported.

The latest version adds support for properly exporting the bullets or numbers that are created by using bulleted and numbered paragraph styles in InDesign – normally, these bullets vanish from the resulting RTF file when exported.

Read all about it at

http://www.rorohiko.com/wordpress/indesign-downloads/text-exporter/

How and why to use Script Labels in InDesign

Tuesday, November 17th, 2009

In this blog post, I want to talk a bit about the secretive Script Label in InDesign.

You might have noticed the Script Label palette, and wondered what it was used for – it’s under Windows – Automation – Script Label.

First I’ll explain what it is all about, and then I’ll dive into some practical scenarios to show you how you can use the Script Label to save lots of time. Most of the info in this blog post is applicable to Mac and Windows versions of InDesign CS, CS2, CS3 or CS4.

1. Big Word of the Day: Meta-Information

In most companies or institutions, ‘Adobe InDesign’ does not live on an island. It’s a cog in a bigger system.

There is a natural ‘flow’ of information throughout the company – orders or requests come in, and somewhere along the line, designers build or modify InDesign documents based on information they receive one way or another – a project brief, a meeting, an e-mail, a telephone call…

Then they pass the result of their work on to the next person or system down the line – as an InDesign file, an InCopy file, a PDF file, a web page, a stack of physical paper,…

In some companies, this flow of information is informal and unstructured.

In other companies (typically larger ones), the flow of information has more or less structure. There are rules and procedures and regulations. You’ll hear about things like ‘order forms’ or ‘job tickets’ or ‘job jackets’ being passed around.

Sometimes there are tangible envelopes or manilla folders with stuff in them, sometimes there is just electronic data being passed around via a central computer system…

In all this hustle and bustle, having a way to keep some tidbits of extra information about an InDesign document inside the document can come in very handy.

This extra info is not meant to be part of the printed end-result. Instead it provides you with critical info about the document: who is the customer? By when is it due? Who should you ring if you have questions? What inks can you use? What is the target resolution? How many pages can you have? And so on…

All such information is sometimes referred to as meta-information – it’s information about how to treat the information in the document.

Having the answers to questions like the ones above readily available ‘inside’ the InDesign document can make a world of difference. No need to ring around in order to figure something out if the info is right there for you to read, inside the document.

There are many ways to do this.

You might have a simple text frame out on the pasteboard with information typed into it. (On a related note – you might want to check out our free HistoryLog plug-in – it uses this idea to provide you with an automatic document history. http://www.rorohiko.com/wordpress/indesign-downloads/history-log/).

You might be using part of the document name to refer to the customer code or hold a deadline date (e.g. so you’d know that a document called RORO12_20091112.indd is related to customer code RORO12 and is due by 12-Nov-2009).

Meta-information is where the Script Label comes in handy: the Script Label is a convenient way to attach a little bit of text, any text, to a page item.

InDesign does not care what text you attach. Whatever you put into the script label won’t normally affect the output of your document – but it’ll keep the text with the page item.

2. Practical Use of the Script Label

Some people use the Script Label to tag page items for automated processing by a script – hence its name ‘Script Label’: it is very often used by script developers.

However, it is not limited to just that. Your imagination is the limit.

I’ve made up a sample scenario here – read it, and that might give you some new ideas. I’ve called this scenario ‘the todo-list-scenario’.

There’s some scripting involved, but you don’t need any scripting knowledge to make use of it – if you can follow instructions, you should be able to make this work.

The problem: imagine I have a spread with heaps of text frames, and all of these page items need to be inspected. Some of them need to be modified depending on what I find.

Suppose all these text frames contain customer comments for the Playamathing toy, and they might or might not contain a reference to a color.

There’s a frame that contains the text “I really love the red Playamathing”. Another says “The yellow Playamathing with the extra knobs is my favourite”, and so on… Imagine there are hundreds of those frames, scattered all over the layout in a fairly haphazard layout.

My task is to read all these bits of text, and change the background of the frames to match the color mentioned, if there is one. If no color is mentioned, I am to leave the background white.

How do I keep track of which ones I’ve inspected and which ones I still need to do? Script Label to the rescue!

2.1 Marking page items with a script label

First of all, I select all text frames. Then I bring up the Script Label palette and type ‘TODO’ in it. Then I click somewhere in the pasteboard area. Through that simple manipulation, I’ve now ‘marked’ all selected text frames with a script label ‘TODO’.

snap1

I now keep the Script Label palette open, and each time I finish one of the text frames, I simply remove the ‘TODO’ from the script label for that text frame.

snap2

2.2 Using Scripts

This approach is still rather cumbersome, and we’ll improve it through a few simple scripts and keyboard shortcuts. Here’s how!

Open a text editor. You could use Notepad on Windows, or TextWrangler (http://www.barebones.com) on Mac.

Don’t use the Apple-provided TextEditor – it will try to save your script in RTF format instead of plain text, and then it won’t work.

Tip: if you’re really in a bind, Stickies (the sticky-note app that comes with Mac OS X) works better than TextEditor when it comes to creating plain text files.

Type the following text into a new text file:

app.selection[0].label = "TODO";

This is a one-line script. There are a few small ‘gotchas’, and I’ll discuss those later, but it’ll do.

Save the one-line text document into a file called mark_todo.jsx

Make sure the file extension is .jsx, not something else. It’s easy to accidentally create a file called mark_todo.jsx.txt (with an extra .txt file name extension). To compound that problem, the Windows Explorer or Mac Finder are often configured to not show the final .txt, and hence such a file might look OK, yet refuse to work. Be aware that what looks like a .jsx file might not be one.

Now, store this mark_todo.jsx file in the InDesign Scripts – Scripts Panels folder. Go to your InDesign application folder, then into Scripts, then into Scripts Panels. Put the mark_todo.jsx file there.

(A method to quickly get to the Scripts Panel folder is to right-click or control-click the Application folder on the Scripts Palette in InDesign and then select Reveal in Finder or Reveal in Explorer).

snap3

Now duplicate mark_todo.jsx file, and rename the duplicated file to unmark_todo.jsx. Then open unmark_todo.jsx in your text editor and eliminate the four letters of TODO, so it reads:

app.selection[0].label = "";

snap3a

Go back to InDesign. On the Scripts Palette in InDesign, when you double-click either mark_todo.jsx or unmark_todo.jsx, they will look at the current selection, then take the very first item in that selection, and adjust the script label of that item to either be TODO or nothing.

These two scripts have some limitations, as you’ll find out. Try this: make sure no page item is selected and then double-click either one of them on the scripts palette.

blog_scriptlabel_errormessage

You get a nice big fat error dialog: the script is trying to access part of ‘the selection’ and nothing is selected, so InDesign is a little bit unhappy about that.

Not to worry! You can safely ignore this – nothing bad has happened. We’ll just live with that behavior for now – simply keep in mind that you must have a single item selected before running either script.

2.3 Using Keyboard Shortcuts

The next step is to assign some keyboard shortcuts to these two scripts. Go to Edit – Keyboard Shortcuts, and create a new set if necessary – I created a set called Todo Script Set. Go into the Product Area Scripts, and then assign shortcuts to the two scripts – on my Mac, I’ve assigned them Ctrl+T and Ctrl+U. On Windows you might want to pick some other shortcuts – pick something that works for you.

blog_scriptlabel_keyboardshortcuts

The scripts palette should now show these shortcuts next to the scripts. Bring the Script Label palette into view, select a page item and repeatedly hit Ctrl+T followed by Ctrl+U while observing the Script Label palette. The word TODO should appear and disappear from the Script Label palette each time you hit the shortcut.

That’s another step in the right direction – marking and unmarking individual page items just became a whole lot easier.

2.4 Finding marked items

Now the next question is: how to quickly find page items that still have a ‘TODO’ script label? Sadly enough the standard ‘Find’ function in InDesign does not seem to be of much help.

Scripting to the rescue! Below a script that finds the next item with a ‘TODO’ script label.

do
{
  if (app.documents.length == 0)
  {
    break;
  }

  var document = app.activeDocument;
  if (! (document instanceof Document))
  {
    break;
  }

  var currentItem = null;
  if (app.selection.length > 0)
  {
    currentItem = app.selection[0];
  }

  var undoneItems = [];
  for (var idx = 0; idx < document.allPageItems.length; idx++)
  {
    var pageItem = document.allPageItems[idx];
    if (pageItem.label == "TODO")
    {
      undoneItems.push(pageItem);
    }
  }
  if (undoneItems.length <= 0)
  {
    break;
  }

  var nextItemIdx = 0;

  if (currentItem != null)
  {
    var currentItemIdx = -1;
    var searchItemIdx = 0;
    while (currentItemIdx == -1 && searchItemIdx < undoneItems.length)
    {
       if (undoneItems[searchItemIdx] == currentItem)
       {
         currentItemIdx = searchItemIdx;
       }
       searchItemIdx++;
    }
    if (currentItemIdx >= 0)
    {
      nextItemIdx = currentItemIdx + 1;
      if (nextItemIdx >= undoneItems.length)
      {
        nextItemIdx = 0;
      }
    }
  }

  app.select(undoneItems[nextItemIdx]);
}
while (false);

I won’t elaborate on how this script works – if you’ve done some ExtendScript-ing before it should be fairly easy to follow. If you’re new to ExtendScript – simply make sure you copy the script verbatim.

Save this script to your Scripts Panel folder as next_todo.jsx.

Each time you double-click this script, the currently selected item will ‘jump’ to the next item that still has a TODO label. You can assign another shortcut key to this script – I used Ctrl+N on my Mac. Each time I hit Ctrl+N, my selection jumps to the next page item with a TODO label.

2.5 Seeing Marked Items

We’re not done yet! If you install our FrameReporter plug-in (http://www.rorohiko.com/framereporter) you can configure it to visually show the script labels. With FrameReporter active, and configured like this:

Screen shot 2009-11-18 at 3.26.27 PM

I can do Select All on my spread, and I get to see this:

Screen shot 2009-11-18 at 3.29.23 PM

I can immediately see that two of the three items still haven’t been examined. Unlike most of our plug-ins, FrameReporter is not a freebie, but it’s still a steal at just US$29.

2.6 InDesign CS4 Live Preflight

But wait, there is more! Soon, we’ll have the YeShore plug-in available which extends the InDesign CS4 Live Preflight (http://www.rorohiko.com/wordpress/yeshore). It has a number of powerful new preflight rules, one of which involves script labels.

If you have YeShore installed (e.g. because you’re on our beta program – check the web page to find out more), you can configure a rule to find all unfinished page items:

Screen shot 2009-11-18 at 3.34.43 PM

I’ve made a preflight profile called ‘Check all done’ and added a rule that says that the script label should not be TODO. With this profile active, it becomes very easy to see how many items I still have to handle, and to ‘hop’ to any items that are still marked as TODO. I simply click on one of the lines in the Preflight panel and InDesign immediately selects the corresponding item.

Screen shot 2009-11-18 at 3.37.12 PM3. Conclusion

I hope that these samples are useful! And if you’re interested, check out FrameReporter, or stay tuned to hear more about YeShore!

Cheers,

Kris

ImageLibraryLoader 1.0.7 Released

Wednesday, November 4th, 2009

ImageLibraryLoader is a free plug-in for InDesign which allows you to quickly set up a floating palette filled with images from one or more designated folders. In many cases, it is much faster than Adobe Bridge, as it uses standard InDesign library palette – so there is no external app to launch.

ImageLibraryLoader 1.0.7 is an update specifically for InDesign CS3 users – the Paste Into command did not work on CS3 with the previous version 1.0.6.

ImageLibraryLoader and ImageHorn, another free plug-in we have on offer, work great as a combo – read all about it in this post:

How to Populate a Template With Images in No Time At All

TextExporter 2.1.1 Available

Tuesday, November 3rd, 2009

TextExporter is a free plug-in for InDesign that export all the stories of an InDesign document into a single file (RTF, InDesign Tagged Text or plain text).

The recent upgrades worked a lot faster than before when used with InDesign/InCopy CS3 and CS4 – but it turns out things were broken in InDesign/InCopy CS and CS2. Also, frame-by-frame export did not account for text in anchored frames.

Version 2.1.1 corrects that. Get it the latest and the greatest here:

http://www.rorohiko.com/textexporter

FrameReporter 1.0.6 Released

Monday, November 2nd, 2009

FrameReporter uses little non-printing labels to display interesting info about selected page items, right in your work area.  Normally InDesign makes you click around and find various palettes to dig up the info – which disrupts your train of thought.

With FrameReporter, the relevant info is displayed exactly in the area where you are working, and you can immediately see the necessary info for multiple items in the blink of an eye.

For example: FrameReporter will show overset text warnings on the edge of any text frame that is part of a linked set of frames.

This latest version fixed a number of bugs and also has substantial speed improvements – the previous version was causing noticeable delays.

Check it out – click here for more info:

http://www.rorohiko.com/framereporter

TextExporter 2.0.9 Available

Sunday, November 1st, 2009

Turns out that our recent update for the free TextExporter plug-in for InDesign was running much, much slower than it should on any reasonably sized document. Version 2.0.9 fixes this abnormal slowdown. Go to get it here:

http://www.rorohiko.com/textexporter

TextExporter is a free plug-in for InDesign that export all the stories of an InDesign document into a single file (RTF, InDesign Tagged Text or plain text).

Soxy 0.2.1b Released

Saturday, October 31st, 2009

Download it herehttp://www.rorohiko.com/wordpress/downloads/lightning-brain-soxy

Changes since 0.2.0b:

  • Fixed bug where selections go white on some lists.
  • Fixed bug where setting Soxy as the default app crashed the program.
  • Some other minor bug fixes.

There’s a common problem when there are multiple versions of applications like Adobe® InDesign®, QuarkXPress®, Adobe Illustrator®… installed on the same computer.

Double-clicking a file’s icon will often cause the wrong application version to launch. As a result, you might unwittingly re-save a document into a more recent file format, which could be a bad thing. Maybe it’s a customer file, and the customer might not be able to open the updated file when you e-mail it back to her.