Site logo

Move to guide or resize

This script is similar to the Move to column or resize script, but the object moves or resizes vertically up or down according to horizontal guides instead.

Description:

With one object selected, move the object to the nearest horizontal guide. If it is already on a guide, do not move it.
Then, (depending on user choice) increase or decrease the height of the object to the nearest horizontal guide.
The script references the horizontal guides on the current page.

You should select one object that has bounds. It will be aligned using visual bound which is useful for objects that have a thick stroke.

Here is a short screen record illustrating how it works.

All the job is done by the main script — Move to guide or resize.jsx (don't run it from the Scripts panel) — which is triggered by one of five other small scripts:

  1. Move.jsx
  2. Decrease to top.jsx
  3. Decrease to bottom.jsx
  4. Increase to top.jsx
  5. Increase to bottom.jsx

For this purpose, I use the doScript() command which sends the only argument: the script's file name itself.
In this way, I don’t have to write and maintain two or more almost identical scripts. I just can run it from a number of small scripts sending the necessary parameter.

Before

Decrease to bottom

Decrease to top

Increase to bottom

Increase to top

Move (to the nearest horizontal guide)

All three scripts should be located in the same folder.

You can Undo/Redo the script

Click here to download the script.

Go back to the main Scripts for L'Express de Toronto Inc. page