Skip to main content
Participant
March 21, 2025
Question

How to select multiple ruler guides in Photoshop to move them

  • March 21, 2025
  • 2 replies
  • 460 views

How do I select multiple ruler guides in Photoshop to move them all at once? In Illustrator is so easy. but photoshop won't let me marquee select them. I don't want to move them one by one. Can I even group them?

2 replies

Stephen Marsh
Community Expert
Community Expert
March 22, 2025

@Lorena39032830k5p1 – You can use this script to move all guides without having to select them. Note: artboard guides will become canvas guides.

/*
Move All Guides v1-0.jsx
Stephen Marsh
22nd March 2025
https://community.adobe.com/t5/photoshop-ecosystem-discussions/how-to-select-multiple-ruler-guides-in-photoshop-to-move-them/td-p/15224622
Info: Shifts all guides in the active document by a specified amount in either the vertical and horizontal directions in the selected ruler units
*/

#target photoshop;

// Create the dialog window
var dlg = new Window("dialog", "Move All Guides (v1.0)");
dlg.orientation = "column";

// Create the panel
var panel = dlg.add("panel", undefined, "");
panel.orientation = "column";
panel.alignChildren = "left";

// Vertical move input
var verticalGroup = panel.add("group");
verticalGroup.add("statictext", undefined, "Vertical Guides Shift:");
var verticalInput = verticalGroup.add("editnumber", undefined, "0");
verticalInput.characters = 5;

// Horizontal move input
var horizontalGroup = panel.add("group");
horizontalGroup.add("statictext", undefined, "Horizontal Guides Shift:");
var horizontalInput = horizontalGroup.add("editnumber", undefined, "0");
horizontalInput.characters = 5;

// Unit selection dropdown menu
var unitGroup = panel.add("group");
unitGroup.add("statictext", undefined, "Ruler Units:");
var unitDropdown = unitGroup.add("dropdownlist", undefined, ["Pixels", "Inches", "Centimeters", "Millimeters", "Points", "Picas"]);
unitDropdown.selection = 0; // Default to 'pixels'

// Add Cancel and OK buttons
var buttonGroup = dlg.add("group");
buttonGroup.alignment = "right";
var cancelButton = buttonGroup.add("button", undefined, "Cancel", { name: "cancel" });
var okButton = buttonGroup.add("button", undefined, "OK", { name: "ok" });

// Convert the unit selection to Photoshop UnitValue abbreviations
function getUnitAbbreviation(selection) {
    switch (selection) {
        case "Pixels": return "px";
        case "Inches": return "in";
        case "Centimeters": return "cm";
        case "Millimeters": return "mm";
        case "Points": return "pt";
        case "Picas": return "pc";
        default: return "px";
    }
}

// OK button handler
okButton.onClick = function () {
    var hValue = parseFloat(horizontalInput.text) || 0;
    var vValue = parseFloat(verticalInput.text) || 0;
    // If both values are zero, cancel execution
    if (hValue === 0 && vValue === 0) {
        alert("Both shift values are zero!");
        return;
    }
    // Single history stage undo
    app.activeDocument.suspendHistory("Move All Guides", "main()");
    dlg.close();
};


// Cancel button handler
cancelButton.onClick = function () {
    dlg.close();
};

// Render the dialog window
dlg.show();


function main() {

    var hValue = parseFloat(horizontalInput.text) || 0;
    var vValue = parseFloat(verticalInput.text) || 0;
    var unit = getUnitAbbreviation(unitDropdown.selection.text);

    if (app.documents.length > 0) {

        // Set the active document and guide variables
        var doc = app.activeDocument;
        var guides = doc.guides;
        var guideData = [];

        // Collect guide data
        for (var i = 0; i < guides.length; i++) {
            guideData.push({
                direction: guides[i].direction,
                coordinate: guides[i].coordinate.as(unit)
            });
        }

        // Remove all existing guides - yes, it's a hack!
        while (guides.length > 0) {
            guides[0].remove();
        }
        // Add new guides with updated positions
        for (var j = 0; j < guideData.length; j++) {
            var newCoord;
            if (guideData[j].direction == Direction.VERTICAL) {
                newCoord = guideData[j].coordinate + vValue;
            } else if (guideData[j].direction == Direction.HORIZONTAL) {
                newCoord = guideData[j].coordinate + hValue;
            }
            doc.guides.add(guideData[j].direction, new UnitValue(newCoord, unit));
        }
        //alert("Guides moved!");

    } else {
        alert("There are no documents open!");
    }
}

 

  1. Copy the code text to the clipboard
  2. Open a new blank file in a plain-text editor (not in a word processor)
  3. Paste the code in
  4. Save as a plain text format file – .txt
  5. Rename the saved file extension from .txt to .jsx
  6. Install or browse to the .jsx file to run (see below)

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Genius
March 21, 2025

https://helpx.adobe.com/photoshop/using/grid-guides.html

The method to select multiple guides is explained in that help file.