Tired of nudging anchor points just to square‑off a call‑out?
Whether you’re labelling a product diagram or building an infographic, keeping those little leader lines perfectly horizontal and vertical is a repetitive pain. And if the line has to dodge an image—forming a tidy “C” or “S” shape—the manual tweaking multiplies.
The Easy Right‑Angled Line Script wipes out that busy‑work:
- Draw a plain, straight Graphic Line from source to target.
- Keep it selected and run Create_Right_Angled_Line.jsx.
- Mess with the settings until it looks right, and hit OK.
- Bam – the script redraws a surgically straight “L”, “C” or “S”‑shaped leader.
- Not quite right? Just select the line again and re-run the script.
- Need to flip the bend? Just tick “Swap line directions”. No redrawing, no lost anchors.
Why you’ll love it
Time‑Saver | How the script helps |
---|---|
Perfect right angles | Generates orthogonal bends automatically – no eyeballing. |
Keeps original anchors | Start & end points stay locked to your artwork; only the mid‑points move. |
Instant “C” / “S” shapes | A single checkbox adds a third segment; the distance is set with a synced slider + textbox. |
Live, modeless preview | Tug the slider and watch the path update in real time without blocking your document. |
One‑click undo | Each preview refresh and the final commit are grouped into tidy History entries. |
Script (GitHub Gist)
Here’s the goodies:
Quick install
- Download the script (link to GitHub Gist – see options below).
- Drop SquareLineSelector.jsx into your InDesign Scripts > Scripts Panel folder.
- For me, on Windows, it’s located here: C:\Program Files\Adobe\Adobe InDesign 2024\Scripts\Scripts Panel
- Restart InDesign or refresh the Scripts panel.
- That’s it – double‑click the script whenever you need a square leader.
- You can also open your scripts panel -> right click on a folder -> click on Reveal in Explorer and that will open your scripts location too.

Target version: Written and tested in InDesign 2024/2025 (ExtendScript).
The#targetengine "SquareLineSelector"
directive keeps the palette open between runs.
UI tour
<!– optional visual –>
Control | Function |
---|---|
Swap line directions | Choose whether the path goes horizontal‑then‑vertical or vertical‑then‑horizontal. |
3‑sided line | Adds an extra leg so the path can dodge content (“C” or “S”). |
3‑sided distance (slider + textbox) | Live‑linked widgets. Drag for rough length, type for precision (supports –1000 → +1000 px). |
Live preview | Toggle real‑time updates. Disable if you’re manipulating huge files. |
OK / Cancel | Commit or revert in a single undoable step. |
(The previous “Selector on opposite end” option was removed in v1.1 – it’ll return when custom end‑caps land.)
Under the hood – what changed in v1.1?
Area | v1.0 | v1.1 (current) |
---|---|---|
3‑sided orientation | Dropdown to pick horizontal/vertical extra leg | Orientation is decided automatically by the current bend direction – one less click. |
Distance slider | Fixed 0–300 px | Dynamic – range shifts ±1000 px around your current value so you’re never constrained. |
Placeholder options | End‑selector & styling checkboxes | Commented‑out code removed for clarity; ready for future bolt‑ons. |
Geometry engine highlights
jsxCopyEdit// Mid‑anchor(s) calculation
if (swapDirection){ // vertical‑then‑horizontal
midAnchor = [xA, yB];
if (threeSided) {
midAnchor = [xA, yA + dist];
midAnchorTwo = [xB, yA + dist];
}
} else { // horizontal‑then‑vertical
midAnchor = [xB, yA];
if (threeSided) {
midAnchor = [xA + dist, yA];
midAnchorTwo = [xA + dist, yB];
}
}
- No math libraries required.
- Resulting
pathArray
rewires the line in one hit, then setsfillColor = "None"
to guarantee a hollow stroke.
Real‑world tips
- Pre‑define an Object Style for leader strokes. Convert first, then apply the style to lock in weight & colour.
- Use Live preview sparingly on mega‑sized documents – disable it if you notice lag, set your parameters, then click OK.
- Batch it with Actions: run the script on each leader, hit the same OK settings, and you’ll be done before you could drag a second anchor by hand.
Extending the script
The heavy lifting lives in updateSquareLine()
, so you can safely splice in extras:
- Arrow heads – InDesign supports
strokeStart
/strokeEnd
. - Custom selector caps – draw a tiny shape after the path is rebuilt.
- Dynamic stroke styles – query the slider value and switch to a dashed line beyond X px.
Feel free to fork the Gist and send a pull request – we love seeing improvements!
Limitations & gotchas
- Works on one selected Graphic Line at a time (to avoid ambiguity).
- Ignores Bézier curves – your source line must be straight.