AutoStick | Simple Diagrams Made Easy
March 02, 2018 | Snippets | en | fr
At the beginning of this short story my goal was to create a utility—well, this still is a utility!—for editing stickers in InDesign. By sticker I mean very simple blocks, one-line text frames having some border and containing a title or just a few words. On many occasions I need that kind of instant bricks for visualizing and connecting ideas, list items, and the whole kit and caboodle.
And, as I spend most of my time with InDesign running, I'm inclined to mindlessly create a new document and start sketching here as if the application was an outliner (which it is definitely not!) On the other side, InDesign is so convenient for shaping and arranging visual data that I'm always looking for strategies to speed up editing features, while keeping full graphic freedom.
Stickers are probably the best example in this respect. Text frames then become kind of atomic cells which, once shaped, just need to receive data and proliferate. All serious questions about composition and textuality vanish. What you want is, keep the Type Tool on hand, enter or edit tags, duplicate cells according to some rule, and go on.
Now the fact is, since every sticker consists of one short and single paragraph we hardly use Enter
or Tab
keys in it, do we? So we could reinterpret these unused keys as commands for creating new cells. That's the very idea on which AutoStick relies.
Cloning and Linking Text Frames
Give a look to the demo:
The script AutoStick (for InDesign CS6 and CC) is quite simple in fact. I won't bore you with its technical aspects, just know it exploits an IdleTask
, a listening mechanism that allows a script to almost instantly react to some change. So, for example, when you press Enter
in a text frame, InDesign actually generates a line break here, but AutoSick captures that event, removes the line break and executes its preprogrammed task instead. It duplicates the frame where the event occured, positions the new frame accordingly and draws a graphic line between the two components.
Note. - Another example of the IdleTask
trick has been shown in ISFR #10: “Making a Group Responsive Using an IdleTask”. Here is the YouTube demo: Group Magnet.
As AutoStick's JSX
code is delivered in clear, advanced users have the option to refine some settings. In particular:
• You can discard the auto link feature by setting the AUTO_LINK
constant to false
. Then the generated blocks won't be connected, unless you type an underscore (_
) before pressing the command key.
• You can adjust the spacing ratios (DX
and DY
in the script) that determine horizontal (resp. vertical) spacing as a percentage of the width (resp. height) of the frame under consideration. Default values are 20%
horizontally, and 50%
vertically.
• You could even change the command keys themselves (defined in the DUPL_CMD
constant) in case you have special shortcut keys making the script ineffective. AutoScript indeed assumes the following:
Shortcut Key | InDesign Character | AutoStick Task |
---|---|---|
Enter | \x0D (U+000D) | Duplicate Down |
Tab | \x09 (U+0009) | Duplicate Right |
Shift Enter | \x0A (U+000A) | Duplicate Up |
Shift Tab | \x08 (U+0008) | Duplicate Left |
Installation and Usage
Download and install the script as usual. AutoStick works as a switch. Run it to turn it on, run it again to turn it off. When it is active, text frames with nonzero borders are managed through the Enter
, Tab
, Shift+Enter
, and Shift+Tab
keys, as illustrated above. The other text frames are not spied on and behave normally.
Comments
The moment I saw this script, the first application I saw a use for this was family trees. This is excellent