/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idi-p/14451554Feb 27, 2024
Feb 27, 2024
Copy link to clipboard
Copied
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.
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14451741#M20931Feb 27, 2024
Feb 27, 2024
Copy link to clipboard
Copied
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.
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14451759#M20932Feb 27, 2024
Feb 27, 2024
Copy link to clipboard
Copied
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.
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14452859#M20939Feb 27, 2024
Feb 27, 2024
Copy link to clipboard
Copied
I don't always need both horizontal and vertical guides. Sometimes, I simply need one or two guides but in different areas.
and
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.
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:
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14452882#M20940Feb 27, 2024
Feb 27, 2024
Copy link to clipboard
Copied
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!
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14453019#M20942Feb 27, 2024
Feb 27, 2024
Copy link to clipboard
Copied
The following .jsx script creates multiple guides using the current ruler units.
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);
}
}
}
}
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14453871#M20947Feb 28, 2024
Feb 28, 2024
Copy link to clipboard
Copied
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.
/*
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;
}
}
/t5/photoshop-ecosystem-ideas/dual-guide-creation-horizontal-amp-vertical/idc-p/14905581#M23186Oct 08, 2024
Oct 08, 2024
Copy link to clipboard
Copied
LATEST
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.
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.