Convert object to guides

Script for InDesign CC 2015, version 1.0.

This script attempts to imitate the Make Guides feature available in Illustrator (View > Guides > Make Guides)

The script makes non-printing and locked layer on top of all layers if it doesn´t exist yet. If it already exists, it will be moved to the top.

Then it moves the selected objects to it applying the following attributes:

If you select an invalid object -- for example, some text -- the script will ignore it.

Before

After

The whole script can be undone and redone.

Click here to download the script (written and tested in InDesign CC 2015.4)

Here is a version for InDesign CS3. (The undone/redone feature is unavailable in this version)