Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
3

Dual Guide Creation (Horizontal & Vertical)

Community Beginner ,
Feb 27, 2024 Feb 27, 2024

It would be nice when creating guides you could create both horizontal and vertical guides all at once. It is very tedious to have to create every single guide needed for a graphic project. 

Idea No status
TOPICS
macOS , Windows
876
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
13 Comments
Community Expert ,
Feb 27, 2024 Feb 27, 2024

@MorgaineChristensen have you checked out

2024-02-27 14_53_24-Window.png2024-02-27 14_52_59-Window.png

Translate
Report
Community Expert ,
Feb 27, 2024 Feb 27, 2024

@MorgaineChristensen 

 

Can you explain how this would work?

 

Would there be a dialogue where you enter the X & Y coordinates?

 

Would you click on the canvas and a horizontal and vertical guide would be automatically placed? Something else?

Translate
Report
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

My thoughts are, like it is used now, via inches or a percentage but with a box you can check if you wish to add both at the same time.  It would be the same inches/percentage applied for both horizontal and vertical.

Translate
Report
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

Thank you, Ged.  I am not sure your suggestion would assist me in what I do.  I don't always need both horizontal and vertical guides.  Sometimes, I simply need one or two guides but in different areas.

Translate
Report
Community Expert ,
Feb 27, 2024 Feb 27, 2024
quote

I don't always need both horizontal and vertical guides.  Sometimes, I simply need one or two guides but in different areas.

 

and

 

quote

My thoughts are, like it is used now, via inches or a percentage but with a box you can check if you wish to add both at the same time.  It would be the same inches/percentage applied for both horizontal and vertical.


By @MorgaineChristensen

 

So these two replies appear to conflict with each other? It would appear that your requirements are inconsistent and depend on the task at hand.

 

So if you need multiple guides at specific entry points, if you were able to enter multiple values would that work for you? Similar to this screenshot mockup:

 

2024-02-28_11-25-26.png

 

 

Translate
Report
Community Beginner ,
Feb 27, 2024 Feb 27, 2024

I am sure my replies seem inconsistent to others.  I often wish others could read my mind; life would be so much easier.  It is true my projects are varied and often dependent on the task at hand.  For those projects that are consistent, I do have a number of templates created with the needed guides set up via the usage of the .psdt file extension.  

I like your mockup, which would make life easier even if you had to do separate horizontal and vertical positions. I still believe a button to check to indicate adding both horizontal and vertical positions at the same time along with your idea of multiple positions would be fantastic and a great timesaver.   People wouldn't have to use it just be available if they need or want to use it to set up their workspace.  

Thanks Stephen for taking the time to listen to my "feature wish" and offer solutions.  I greatly appreciate it!  Again, thank you!

Translate
Report
Community Expert ,
Feb 27, 2024 Feb 27, 2024

@MorgaineChristensen 

 

Please don’t take my previous comment as criticism, I was just noting that you appear to have varied requirements.

 

For an idea/feature request, the developers need clear and concise, step-by-step explanations of what you think would make Photoshop better.

 

The same goes for someone who was going to create a script.

 

Translate
Report
Community Expert ,
Feb 27, 2024 Feb 27, 2024

The following .jsx script creates multiple guides using the current ruler units.

 

2024-02-28_20-00-08.png

 

Enter one or more vertical coordinates as , comma-separated values. Use a semi-colon ; to separate the vertical from the horizontal coordinates. Enter one or more horizontal coordinates as , comma-separated values. Vertical or horizontal can be blank, however, you must still include the ; semi-colon separator before the horizontal value:

 

 

/*
Add Multiple Horizontal & Vertical Guides from Prompt.jsx
v1.0 - 28th February 2024, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14453019
NOTES: Enter one or more vertical coordinates as , comma-separated values. Use a semi-colon ; to separate the vertical from the horizontal coordinates. Enter one of more horizontal coordinates as , comma separated values. Vertical or horizontal can be blank, however, you must still include the ; semi-colon separator before the horizontal value.
*/

#target photoshop

// Prompt for both vertical & horizontal guide positions
var thePrompt = prompt("VERTICAL;HORIZONTAL (" + app.preferences.rulerUnits.toString().replace(/Units\./, "") + "):" + "\n" + "100,200,300;150,250", "");
if (thePrompt !== null && thePrompt !== "") {
    addGuidesFromPrompt(thePrompt);
} else {
    //alert("No coordinates entered!");
}


function addGuidesFromPrompt(thePromptInput) {
    // Split the input string into an array of values
    var theCoords = thePromptInput.split(";");
    // Loop through each value and add it as a guide
    for (var i = 0; i < theCoords.length; i++) {
        // Split the guide values into horizontal and vertical arrays
        var theGuidesCoords = theCoords[i].split(",");
        // Loop over the guides
        for (var j = 0; j < theGuidesCoords.length; j++) {
            // Convert the string to a number
            var theGuidesPos = parseInt(theGuidesCoords[j], 10);
            // Add the guides
            if (i === 0) {
                app.activeDocument.guides.add(Direction.VERTICAL, theGuidesPos);
            } else {
                app.activeDocument.guides.add(Direction.HORIZONTAL, theGuidesPos);
            }
        }
    }
}

 

 

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

 

Translate
Report
Community Beginner ,
Feb 28, 2024 Feb 28, 2024

No worries!  I wasn't offended in the least. My mind goes all different directions at once, I am horrible at clear and concise steps.  LOL which is why I more than likely won't put in a development request. I would drive the developer crazy I am sure.  

Translate
Report
Community Expert ,
Feb 28, 2024 Feb 28, 2024

I encourage you to try the script that I wrote if you need this feature now.

 

I have voted for the native ability to add multiple horizontal and or vertical guides at once.

Translate
Report
Community Beginner ,
Feb 28, 2024 Feb 28, 2024

Thank you, Stephen!  You rock!

Translate
Report
Community Expert ,
Sep 15, 2024 Sep 15, 2024

A new script using a custom GUI:

 

2024-09-16_00-02-06.png

 

 

/*
Add Multiple Horizontal or Vertical Guides scriptUI GUI.jsx
Stephen Marsh
v1.2 - Modified version with panel layout and document check
https://community.adobe.com/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14453019
*/

#target photoshop

// Create the dialog window
var dlg = new Window('dialog', 'Add Multiple Horizontal or Vertical Guides (v1.2)');

// Create main panel to contain all input elements
var mainPanel = dlg.add('panel', undefined, 'Guide Settings');
mainPanel.orientation = 'column';
mainPanel.alignChildren = 'left';
mainPanel.margins = 15;

// Group for the input fields (Vertical and Horizontal Guides)
var inputGroup = mainPanel.add('group');
inputGroup.orientation = 'column';
inputGroup.alignment = 'left';

// Vertical guide input section with checkbox
var verticalGroup = inputGroup.add('group');
verticalGroup.orientation = 'row';
verticalGroup.alignment = 'left';
var verticalCheckbox = verticalGroup.add('checkbox', undefined, '');
verticalCheckbox.value = true;
verticalGroup.add('statictext', undefined, 'Vertical Guides:');
var verticalInput = verticalGroup.add('edittext', undefined, '100,200,300');
verticalInput.preferredSize.width = 285;
verticalInput.helpTip = "Add comma separated values for the vertical guides";

// Horizontal guide input section with checkbox
var horizontalGroup = inputGroup.add('group');
horizontalGroup.orientation = 'row';
horizontalGroup.alignment = 'left';
var horizontalCheckbox = horizontalGroup.add('checkbox', undefined, '');
horizontalCheckbox.value = true;
horizontalGroup.add('statictext', undefined, 'Horizontal Guides:');
var horizontalInput = horizontalGroup.add('edittext', undefined, '150,250');
horizontalInput.preferredSize.width = 270;
horizontalInput.helpTip = "Add comma separated values for the horizontal guides";

// Add checkboxes to remove all guides
var removeGuidesGroup = inputGroup.add('group');
removeGuidesGroup.orientation = 'row';
removeGuidesGroup.alignment = 'left';
var removeVerticalGuidesCheckbox = removeGuidesGroup.add('checkbox', undefined, 'Clear Existing Vertical Guides');
removeVerticalGuidesCheckbox.value = false;
var removeHorizontalGuidesCheckbox = removeGuidesGroup.add('checkbox', undefined, 'Clear Existing Horizontal Guides');
removeHorizontalGuidesCheckbox.value = false;

// Group for the unit selection dropdown and label, inside the panel
var unitsGroup = mainPanel.add('group');
unitsGroup.orientation = 'column';
unitsGroup.alignment = 'left';
unitsGroup.spacing = 5;

// Add dropdown for unit selection
unitsGroup.add('statictext', undefined, 'Select Ruler Units:');
var unitDropdown = unitsGroup.add('dropdownlist', undefined, ['pixels', 'inches', 'centimeters', 'millimeters', 'points', 'picas']);
unitDropdown.selection = 0;

// Group for Cancel and OK buttons - outside the panel
var buttonGroup = dlg.add('group');
buttonGroup.orientation = 'row';
buttonGroup.alignment = 'right';
buttonGroup.margins = [0, 10, 0, 0]; // Add some top margin for spacing from panel

// Add Cancel and OK buttons inside the button group (order swapped)
buttonGroup.cancelBtn = buttonGroup.add('button', undefined, 'Cancel', { name: 'cancel' });
buttonGroup.okBtn = buttonGroup.add('button', undefined, 'OK', { name: 'ok' });

// Event listeners to enable/disable input fields based on checkboxes
verticalCheckbox.onClick = function () {
    verticalInput.enabled = verticalCheckbox.value;
}

horizontalCheckbox.onClick = function () {
    horizontalInput.enabled = horizontalCheckbox.value;
}

// Check if there's an open document before showing the dialog
if (app.documents.length === 0) {
    alert("Please open a document before running this script.");
} else {
    // Draw the window
    var result = dlg.show();

    // Run the script
    if (result == 1) {
        // Store the original ruler units
        var originalRulerUnits = app.preferences.rulerUnits;

        try {
            // Set the ruler units based on user selection
            app.preferences.rulerUnits = getUnitTypeFromString(unitDropdown.selection.text);

            // Clear guides if checkboxes are checked
            if (removeHorizontalGuidesCheckbox.value) {
                clearHorizontalGuides();
            }
            if (removeVerticalGuidesCheckbox.value) {
                clearVerticalGuides();
            }

            // Get the input values, but only if the checkboxes are checked
            if (verticalCheckbox.value) {
                var verticalGuides = verticalInput.text.split(",");
                addVerticalGuides(verticalGuides);
            }
            if (horizontalCheckbox.value) {
                var horizontalGuides = horizontalInput.text.split(",");
                addHorizontalGuides(horizontalGuides);
            }

        } catch (err) {
            app.beep();
            alert("Error!" + "\r" + err + "\r" + 'Line: ' + err.line);

        } finally {
            // Reset to original ruler units
            app.preferences.rulerUnits = originalRulerUnits;
        }
    }
}

///// Functions /////

function addVerticalGuides(verticalGuides) {
    for (var i = 0; i < verticalGuides.length; i++) {
        var guidePos = parseFloat(verticalGuides[i]);
        app.activeDocument.guides.add(Direction.VERTICAL, guidePos);
    }
}

function addHorizontalGuides(horizontalGuides) {
    for (var i = 0; i < horizontalGuides.length; i++) {
        var guidePos = parseFloat(horizontalGuides[i]);
        app.activeDocument.guides.add(Direction.HORIZONTAL, guidePos);
    }
}

function clearHorizontalGuides() {
    var guides = app.activeDocument.guides;
    for (var i = guides.length - 1; i >= 0; i--) {
        if (guides[i].direction == Direction.HORIZONTAL) {
            guides[i].remove();
        }
    }
}

function clearVerticalGuides() {
    var guides = app.activeDocument.guides;
    for (var i = guides.length - 1; i >= 0; i--) {
        if (guides[i].direction == Direction.VERTICAL) {
            guides[i].remove();
        }
    }
}

function getUnitTypeFromString(unitString) {
    switch (unitString.toLowerCase()) {
        case 'pixels': return Units.PIXELS;
        case 'inches': return Units.INCHES;
        case 'centimeters': return Units.CM;
        case 'millimeters': return Units.MM;
        case 'points': return Units.POINTS;
        case 'picas': return Units.PICAS;
        default: return Units.PIXELS;
    }
}

 

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

 

Translate
Report
Community Expert ,
Oct 08, 2024 Oct 08, 2024
LATEST
quote

Thank you, Ged. I am not sure your suggestion would assist me in what I do. I don't always need both horizontal and vertical guides. Sometimes, I simply need one or two guides but in different areas.

By @MorgaineChristensen

 

Not sure if this helps with that, but note that in the existing New Guide Layout dialog box screen shot that Ged posted, there are check boxes next to Columns and Rows. So, if you only need some horizontal guides, disable Columns, if you only need vertical guides disable Rows, and if you need both, leave both enabled.

 

And of course you can type in the Number of horizontal or vertical guides, as it shows.

 

This could let you quickly put the right number of horizontal and vertical guides on the canvas, and if you needed non-uniform spacing you could just drag them into place. For example, if I needed one horizontal and three vertical guides but not evenly spaced, then I would enable both Horizontal and Vertical, type 1 into the Number field for Horizontal, type 3 into the Number field for Vertical, click OK, and drag each of those new guides to their final positions.

Translate
Report