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.
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.
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.
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:
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!
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);
}
}
}
}
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
v1.0 - 15th September 2024, Stephen Marsh
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.0)');
// Group for the input fields (Vertical and Horizontal Guides)
var inputGroup = dlg.add('group');
inputGroup.orientation = 'column';
inputGroup.alignment = 'left'; // Left-align the entire group
// Vertical guide input section with checkbox
var verticalGroup = inputGroup.add('group');
verticalGroup.orientation = 'row';
verticalGroup.alignment = 'left'; // Left-align
var verticalCheckbox = verticalGroup.add('checkbox', undefined, '');
verticalCheckbox.value = true; // Default to checked
verticalGroup.add('statictext', undefined, 'Vertical Guides:');
var verticalInput = verticalGroup.add('edittext', undefined, '100,200,300');
verticalInput.characters = 30; // Set width
// Horizontal guide input section with checkbox
var horizontalGroup = inputGroup.add('group');
horizontalGroup.orientation = 'row';
horizontalGroup.alignment = 'left'; // Left-align
var horizontalCheckbox = horizontalGroup.add('checkbox', undefined, '');
horizontalCheckbox.value = true; // Default to checked
horizontalGroup.add('statictext', undefined, 'Horizontal Guides:');
var horizontalInput = horizontalGroup.add('edittext', undefined, '150,250');
horizontalInput.characters = 30; // Set width
// Add checkboxes to remove all guides
var removeGuidesGroup = inputGroup.add('group');
removeGuidesGroup.orientation = 'row';
removeGuidesGroup.alignment = 'left'; // Left-align
var removeVerticalGuidesCheckbox = removeGuidesGroup.add('checkbox', undefined, 'Clear Existing Vertical Guides');
removeVerticalGuidesCheckbox.value = false; // Default to unchecked
var removeHorizontalGuidesCheckbox = removeGuidesGroup.add('checkbox', undefined, 'Clear Existing Horizontal Guides');
removeHorizontalGuidesCheckbox.value = false; // Default to unchecked
// Group for the unit selection dropdown and label, left-aligned
var unitsGroup = dlg.add('group');
unitsGroup.orientation = 'column';
unitsGroup.alignment = 'left'; // Left-align the dropdown
// 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; // Set default to pixels
// Group for OK and Cancel buttons
var buttonGroup = dlg.add('group');
buttonGroup.orientation = 'row'; // Group buttons in a row
buttonGroup.alignment = 'right'; // Align buttons to the right
// Add OK and Cancel buttons inside the button group
buttonGroup.okBtn = buttonGroup.add('button', undefined, 'OK', {name: 'ok'});
buttonGroup.cancelBtn = buttonGroup.add('button', undefined, 'Cancel', {name: 'cancel'});
// Event listeners to enable/disable input fields based on checkboxes
verticalCheckbox.onClick = function() {
verticalInput.enabled = verticalCheckbox.value;
}
horizontalCheckbox.onClick = function() {
horizontalInput.enabled = horizontalCheckbox.value;
}
// 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;
}
} else {
// Handle cancel or no input
//app.beep();
//alert("Script cancelled!");
}
///// 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;
}
}
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.