Copy link to clipboard
Copied
Hi Please help me
Is there any script which can count number of horizontal and vertical image opened in photoshop and copy result text to clipboard.
For example I have 12 jpeg image opened in photoshop, out of which 9 are vertical and 3 are horizontal. Is there any script which can count them oriantation wise and copy text 9V3H to clipboard.
Thanks in advance
Copy link to clipboard
Copied
Is this not discussed in the following thread
PS Script to count number of vertical & horizontal frames in any psd template and rename doc
-Manan
Copy link to clipboard
Copied
Hi..That was different thread sir 😞
Copy link to clipboard
Copied
The other topic thread was about retrieving the count and orientation of multiple layers in a single document.
Is this request different? You now have multiple documents open, all of which have different orientations, landscape, portrait and square? Do you still wish for the square orientation images to be classed as portrait orientation?
Copy link to clipboard
Copied
Ahh, i misread the question. My apologies for that
-Manan
Copy link to clipboard
Copied
Yes sir this is different request...In my first request yes I want square oriantation image to be classed as portrait orientation.
Copy link to clipboard
Copied
A script can look at all the document open in Photoshop and look at their canvas sizes and count the number of landscapes and portraits and create a name like 9V3H and put out a message 9V3H, Could even add as document 9V3H that has a canvas sized to house all the documents visible composite and then stack each document current visible composite into the new document. Photoshop Scripting is very powerful. What you script is up to you when you code the script. To put text is the clipboard may require using some system code in Photoshop to copy text to the clipboard you normally have to be in text edit mode with the text highlighted you want to copy to the clipboard. In Photoshop image are normally copied to the clipboard not text. Photoshop is an image editor not a text editor though it can edit text to some extent.
Copy link to clipboard
Copied
Thank you for your responce sir. I am totally new in scripting forum thats why sometime I ask stupid questions like this. Please don't mind. I tried to learn scripting but its very difficult for me as I am very less educated. I will not disturb anyone if anyone can provide me link from where I can learn more about scripting..from basic to advance 😞
Copy link to clipboard
Copied
Hi Chikal,
You are not disturbing anyone here. If you want to learn, you can read following articles for the scripting
Specifically documenattion for javascript
Adobe Photoshop CC JavaScript Reference
It will take some time to learn all these, but yes you can start by writing small scripts. All the best 🙂
Copy link to clipboard
Copied
Hi, Just in case, It is also possible to get the count of portrait, landscape, square files in a given folder using Adobe Bridge, without opening them.
Copy link to clipboard
Copied
Or still by Photoshop by: ExternalObject.AdobeXMPScript
Copy link to clipboard
Copied
Test to see which is larger, horizontal size or vertical. Pretty straightforward.
Copy link to clipboard
Copied
There is no stupid question. If you do not know something and ask for help it not a sign of stupidity it show you want to learn. Scripts are little programs written is an interpreted scripting language. If you can find an existing script that does what you want it shows you are not the only one that works like you do. If you can not find one you need to code it yourself. You will develop the best actions and scripts yourself for your work-flow. Because you designed them for your work and you know how the work and they work like you want them to.
Copy link to clipboard
Copied
I have opened 4Images, 2Verticle and 2Horizontal, I want to script according 2v2h , Is that possible to according orientation to alert(2v2h); ?
I have described in image, please check it ?
Thanks in Advance...
Copy link to clipboard
Copied
I have no idea what you are asking. I see you have four image open in floating windows two have landscape aspect ratios two have portrait aspect ratios they are being zoomed to different percentage the all see to have a different number of pixels. I have no Idea what you want a script to do?????
Copy link to clipboard
Copied
I want to count the orientation of all images, Like 2h2v
Copy link to clipboard
Copied
I want to count the orientation of all images, Like 2h2v in script
Copy link to clipboard
Copied
All images where on all your system, on a disk, open in Photoshop any particular image file format. If you want to script something you need to to design the precise functions the script will provide.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Yes I saw the thread but i can't find the answar
Copy link to clipboard
Copied
#target photoshop
s2t = stringIDToTypeID;
var len = getPropertyDesc('application', p = 'numberOfDocuments').getInteger(s2t(p)),
result = { v: 0, h: 0 };
for (var i = 1; i <= len; i++) {
var ratio = getPropertyDesc('document', p = 'width', i).getDouble(s2t(p)) >= getPropertyDesc('document', p = 'height', i).getDouble(s2t(p));
result[ratio ? 'h' : 'v']++
}
alert(result['v'] + 'v' + result['h'] + 'h')
function getPropertyDesc(target, property, idx) {
target = s2t(target);
(r = new ActionReference()).putProperty(s2t('property'), s2t(property));
idx ? r.putIndex(target, idx) : r.putEnumerated(target, s2t('ordinal'), s2t('targetEnum'));
return executeActionGet(r);
}
Copy link to clipboard
Copied
Thanku so much Very well
Copy link to clipboard
Copied
Count only jpg image ignore the other document and Psd file
Copy link to clipboard
Copied
Help this result ? not to alert
Copy link to clipboard
Copied
A script has no problem processing Photoshop document array it can process all open document an tally those that are Landscape, Square and Portrait and list all that information. You just need to design how you want to preset the info to the user.
I do not have such a script. Here is a script I use that process all open document to append the clipboard to my open clipboard document.
/* ==========================================================
// 2013 John J. McAssey (JJMack)
// ======================================================= */
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
// I set a shortcut key in my case F5 to this Photoshop script mainly for doing Window screen capturing of:
// desktop displays, Active window and selected area copy to clipboard. The script log the cardboard into a document with the name clipboard.
/*
<javascriptresource>
<about>$$$/JavaScripts/AppendClipboard/About=JJMack's Append Clipboard into Clipboard document.^r^rCopyright 2014 Mouseprints.^r^rJJMack's Script.^r
NOTE:New Clipboard Document will be open if necessary</about>
<category>JJMack's Script</category>
</javascriptresource>
*/
// enable double-clicking from Mac Finder or Windows Explorer
#target photoshop // this command only works in Photoshop CS2 and higher
// bring application forward for double-click events
app.bringToFront();
if (!documents.length) {
NewCliboardDoc ();
app.activeDocument.suspendHistory('appendClipboard','main(true)'); // New document opened proceed
}
else { //locate Document clipboard
for (var i=0;i<app.documents.length;i++) {
app.activeDocument=app.documents[i];
if (app.activeDocument.name == "Clipboard"){break;}
}
if (app.activeDocument.name != "Clipboard"){
NewCliboardDoc ();
app.activeDocument.suspendHistory('appendClipboard','main(true)'); // New document opened proceed
}
else {app.activeDocument.suspendHistory('appendClipboard','main(false)'); } // Old Clipboard Document found
}
///////////////////////////////////////////////////////////////////////////////
// main function //
///////////////////////////////////////////////////////////////////////////////
function main(newFile) {
// declare local variables
var orig_ruler_units = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS
try {
activeDocument.paste(); // past in clipboard may fail enclose in try
var LB = app.activeDocument.activeLayer.bounds; // Get the bounds of the work layer
var LWidth = (LB[2].value) - (LB[0].value); // Area width
var LHeight = (LB[3].value) - (LB[1].value); // Area height
// BOTTOMCENTER BOTTOMLEFT BOTTOMRIGHT MIDDLECENTER MIDDLELEFT MIDDLERIGHT TOPCENTER TOPLEFT TOPRIGHT
if(newFile) {
app.activeDocument.resizeCanvas(LWidth, LHeight, AnchorPosition.TOPLEFT);
app.activeDocument.layers[1].remove();
}
else {
if (LWidth>=app.activeDocument.width) { app.activeDocument.resizeCanvas(LWidth, app.activeDocument.height + LHeight, AnchorPosition.TOPLEFT);}
else {app.activeDocument.resizeCanvas(app.activeDocument.width, app.activeDocument.height + LHeight, AnchorPosition.TOPLEFT);}
}
app.activeDocument.selection.selectAll(); // select all
// Left('AdLf'); Right('AdRg'); Top('AdTp'); Bottom('AdBt'); Center Horizontal('AdCH'); Center Vertical('AdCV');
align("AdLf");align("AdBt"); //Align to selection Left bottom
app.activeDocument.selection.deselect();
SetViewFitonScreen();
//app.purge(PurgeTarget.CLIPBOARDCACHE);
}
catch(e) {
if(newFile) app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
alert("Clipboard Empty");
}
app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings
}
///////////////////////////////////////////////////////////////////////////////
// main function end //
///////////////////////////////////////////////////////////////////////////////
function NewCliboardDoc () {
// app.documents.add([width][, height][, resolution][, name][, mode][, initialFill][, pixelAspectRatio][, bitsPerChannel][, colorProfileName])
var Clipboard = app.documents.add( null, null, 100, "Clipboard", NewDocumentMode.RGB, null, null, null, "sRGB IEC61966-2.1");
}
function align(method) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );
};
function SetViewFitonScreen() {
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(charIDToTypeID('Mn '), charIDToTypeID('MnIt'), charIDToTypeID('FtOn'));
desc1.putReference(charIDToTypeID('null'), ref1);
executeAction(charIDToTypeID('slct'), desc1, DialogModes.NO);
};