Copy link to clipboard
Copied
Hi,
I have an existing custom guide layout and there is no way to save the layout simply by pressing a save option in the submenus shown in the attachment.
It appears you have to go to the sub-menus first before creating the guide layout in the first place, and then painstakingly enetre in the measurement numerical value of each guide.
This guide in the attachment was created by dragging from the ruler edges, like you normally do. And I just want to now save it in one click, like anything else.
Reagrds Wayne
Copy link to clipboard
Copied
in the future, to find the best place to post your message, use the list here, https://community.adobe.com/
p.s. i don't think the adobe website, and forums in particular, are easy to navigate, so don't spend a lot of time searching that forum list. do your best and we'll move the post (like this one has already been moved) if it helps you get responses.
<"moved from cc desktop">
Copy link to clipboard
Copied
That's right, as you have discovered, the way to create a guide layout is to use the interface, you can't save existing guides into a guide layout.
Do you need this guide structure for other documents that are the same canvas width and height in pixels?
Or does the position change depending on the canvas size? Such as a relative 10% from the edge rather than a fixed px value?
Copy link to clipboard
Copied
Well, I have about 15 dam construction illustrations and all need the same border motifs design layout, like a handrawn plaque.
Anyway, I'm just doing it my usual way I've done for years , which is to use the background layer of the first one as a template which saves the guide layout with it .
Just seems wierd that you can save just about every tool setting, but not the guides. why?
Because most of the time I set up guides on the fly, just by dragging from the ruler.
No biggy.
Thanks everyone for input.
Copy link to clipboard
Copied
It appears that you are using the term "guide layout" as a generic term, however, a guide layout is a specific Photoshop feature.
If you are not using the guide layout feature, you can setup the rulers to work in px or % and record an action to capture your unique guide positions for use on other documents.
Copy link to clipboard
Copied
That would be another way. Just record it as an Action.
Thanks.
Still seems wierd that after 40 yrs of Adobe it hasnt occured to any Developer to add such a basic function.
Copy link to clipboard
Copied
Still seems wierd that after 40 yrs of Adobe it hasnt occured to any Developer to add such a basic function.
»40 yrs« may be applicable to Adobe but obviously not to Photoshop.
Copy link to clipboard
Copied
One can »transfer« guides to another file (or rather recreate them) via Script.
So the questions @Stephen Marsh posed are indeed relevent.
edit: An example:
// take guides from active document and add them to other open documents after removing their existing guides;
// 2013, use at your own risk;
#target photoshop
if (app.documents.length > 0 && app.activeDocument.guides.length > 0) {main()};
////// function //////
function main () {
// set to pixels;
var myDocument = app.activeDocument;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// collect guides;
var theArray = new Array;
for (var m = 0; m < myDocument.guides.length; m++) {
theArray.push([myDocument.guides[m].coordinate, myDocument.guides[m].direction])
};
app.preferences.rulerUnits = originalRulerUnits;
// get all open documents;
var theDocs = app.documents;
for (var o = 0; o < app.documents.length; o++) {
var thisDocument = app.documents[o];
// proceed if not original document;
if (thisDocument != myDocument) {
app.activeDocument = thisDocument;
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// remove existing guides;
for (var n = thisDocument.guides.length-1; n >=0; n--) {
thisDocument.guides[n].remove()
};
// add guides;
for (var p = 0; p < theArray.length; p++) {
thisDocument.guides.add(theArray[p][1], theArray[p][0]);
};
app.preferences.rulerUnits = originalRulerUnits;
};
};
};
Copy link to clipboard
Copied
I just looked at this and its trivial to save guide positions to a file and then load those into a new document via scripting.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
That's not how guide layouts work, anyway. They define columns and rows, and not arbitrary guides.
This has to be scripted.
Copy link to clipboard
Copied
Its probably too late but if this problem still exset in PS, you can use My script, It will save the guides into a text file (also editable) and if you need to transfer to new file you can use the same script:
#target photoshop
// Create the user interface
var dialog = new Window('dialog', 'Guide2Text');
dialog.alignChildren = 'center';
// Save Guides Button
var saveBtn = dialog.add('button', undefined, 'SaveGuides');
saveBtn.onClick = function() {
saveGuides();
};
// Insert Guides Button
var loadBtn = dialog.add('button', undefined, 'InsertGuides');
loadBtn.onClick = function() {
loadGuides();
};
// Close Button to safely close the dialog
var closeBtn = dialog.add('button', undefined, 'Close');
closeBtn.onClick = function() {
dialog.close();
};
// Show the dialog
dialog.show();
// Function to save the current guides to a .txt file
function saveGuides() {
var doc = app.activeDocument;
var horizontalGuides = [];
var verticalGuides = [];
// Collect the horizontal and vertical guides
for (var i = 0; i < doc.guides.length; i++) {
var guide = doc.guides[i];
if (guide.direction == Direction.HORIZONTAL) {
horizontalGuides.push(guide.coordinate.value);
} else {
verticalGuides.push(guide.coordinate.value);
}
}
// Sort guides: vertical guides left to right, horizontal guides top to bottom
verticalGuides.sort(function(a, b) { return a - b; });
horizontalGuides.sort(function(a, b) { return a - b; });
// Build the data string
var guidesData = [];
for (var i = 0; i < verticalGuides.length; i++) {
guidesData.push('V:' + verticalGuides[i]);
}
for (var i = 0; i < horizontalGuides.length; i++) {
guidesData.push('H:' + horizontalGuides[i]);
}
// Convert the guidesData array to a string
var guidesString = guidesData.join('\n');
// Prompt the user to save the file
var saveFile = File.saveDialog("Save guides as .txt", "Text Files:*.txt");
if (saveFile) {
saveFile.open('w');
saveFile.write(guidesString);
saveFile.close();
alert("Guides saved successfully!");
}
// Close the dialog to allow focus to return to Photoshop
dialog.close();
}
// Function to load and insert guides from a .txt file
function loadGuides() {
var doc = app.activeDocument;
// Prompt the user to select the file
var loadFile = File.openDialog("Select a saved guides file", "Text Files:*.txt");
if (loadFile) {
loadFile.open('r');
var guidesData = loadFile.read();
loadFile.close();
// Parse the guides data
var guidesArray = guidesData.split('\n');
// Insert guides
for (var i = 0; i < guidesArray.length; i++) {
var guideInfo = guidesArray[i].split(':');
var orientation = guideInfo[0];
var position = parseFloat(guideInfo[1]);
// Add the guide to the document
if (orientation == 'H') {
doc.guides.add(Direction.HORIZONTAL, new UnitValue(position, 'px'));
} else if (orientation == 'V') {
doc.guides.add(Direction.VERTICAL, new UnitValue(position, 'px'));
}
}
alert("Guides inserted successfully!");
}
// Close the dialog to allow focus to return to Photoshop
dialog.close();
}
Copy link to clipboard
Copied
Thanks for sharing!
There have been similar scripts/posts in the past, I'll see if I can dig them up...
Edit: on a related note for creating multiple custom guides;
Copy link to clipboard
Copied
I’ve updated the script to accept tabulated text data, making it easier to export from Excel or Google Docs. This is a more flexible approach, as you can use these programs to create custom patterns or sequences if needed. For example, if you require a sequence of doubling distances like 2, 4, 8, 16...4096, you can easily generate that in Excel and save it as a text file. I’ll attach the updated script here; it's almost the same, with the only change being the format of the points. Previously, the code exported them as 'V:1024', but now it exports and imports them as 'V 1024', which you can easily create in Excel.
#target photoshop
// Create the user interface
var dialog = new Window('dialog', 'Als UnguidedGuides');
dialog.alignChildren = 'center';
// Save Guides Button
var saveBtn = dialog.add('button', undefined, 'SaveGuides');
saveBtn.onClick = function() {
saveGuides();
};
// Insert Guides Button
var loadBtn = dialog.add('button', undefined, 'InsertGuides');
loadBtn.onClick = function() {
loadGuides();
};
// Close Button to safely close the dialog
var closeBtn = dialog.add('button', undefined, 'Close');
closeBtn.onClick = function() {
dialog.close();
};
// Show the dialog
dialog.show();
// Function to save the current guides to a .txt file
function saveGuides() {
var doc = app.activeDocument;
// Preserve original ruler units
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var horizontalGuides = [];
var verticalGuides = [];
// Collect the horizontal and vertical guides
for (var i = 0; i < doc.guides.length; i++) {
var guide = doc.guides[i];
if (guide.direction == Direction.HORIZONTAL) {
horizontalGuides.push(guide.coordinate.value);
} else {
verticalGuides.push(guide.coordinate.value);
}
}
// Sort guides: vertical guides left to right, horizontal guides top to bottom
verticalGuides.sort(function(a, b) { return a - b; });
horizontalGuides.sort(function(a, b) { return a - b; });
// Build the data string
var guidesData = [];
for (var i = 0; i < verticalGuides.length; i++) {
guidesData.push('V\t' + verticalGuides[i]);
}
for (var i = 0; i < horizontalGuides.length; i++) {
guidesData.push('H\t' + horizontalGuides[i]);
}
// Convert the guidesData array to a string
var guidesString = guidesData.join('\n');
// Prompt the user to save the file
var saveFile = File.saveDialog("Save guides as .txt", "Text Files:*.txt");
if (saveFile) {
saveFile.open('w');
saveFile.write(guidesString);
saveFile.close();
alert("Guides saved successfully!");
}
// Restore original ruler units
app.preferences.rulerUnits = originalRulerUnits;
// Close the dialog to allow focus to return to Photoshop
dialog.close();
}
// Function to load and insert guides from a .txt file
function loadGuides() {
var doc = app.activeDocument;
// Preserve original ruler units
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// Prompt the user to select the file
var loadFile = File.openDialog("Select a saved guides file", "Text Files:*.txt");
if (loadFile) {
loadFile.open('r');
var guidesData = loadFile.read();
loadFile.close();
// Parse the guides data
var guidesArray = guidesData.split('\n');
// Insert guides
for (var i = 0; i < guidesArray.length; i++) {
var guideInfo = guidesArray[i].split('\t');
var orientation = guideInfo[0];
var position = parseFloat(guideInfo[1]);
// Add the guide to the document
if (orientation == 'H') {
doc.guides.add(Direction.HORIZONTAL, new UnitValue(position, 'px'));
} else if (orientation == 'V') {
doc.guides.add(Direction.VERTICAL, new UnitValue(position, 'px'));
}
}
alert("Guides inserted successfully!");
}
// Restore original ruler units
app.preferences.rulerUnits = originalRulerUnits;
// Close the dialog to allow focus to return to Photoshop
dialog.close();
}