I just thing to open only horizontal/vertical image from a folder

New Here ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

var fol=Folder.selectDialog('Select a folder With Mixed Image horizontal And vertical Image');
function horizontal(fol){
    var files = fol.getFiles(  //get only horizontal image---------
        );
        for ( i = 0; i < files.length; i++) {
            open(i);
        }

}
function vertical(fol){
    var files = fol.getFiles(  //get only vertical image---------
        );
        for ( i = 0; i < files.length; i++) {
            open(i);
        }

}

i don't know how can I do id 

TOPICS
Actions and scripting, How to

Views

196

Likes

translate

Translate

Translate

Report

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
Most Valuable Participant ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

You would to get all the Image files names then filter the file list be processing the file meta data.  Even the file filtering that can be done on windows is only relative to file types not image attributes. getfiles gets you a list of file names. On Mac you even have to code a filter to filter file types. 

JJMack

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

function gF(v) {
	if (!ExternalObject.AdobeXMPScript)
		ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript'),
		gP = function(v) {return xmp.getProperty(XMPConst.NS_EXIF, 'Pixel' + v + 'Dimension')}
	xmp = new XMPFile(v.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ).getXMP()
	return eval("gP('X') " + lessthanorgreaterthancharacterassignedearlier + " gP('Y')")
}

lessthanorgreaterthancharacterassignedearlier = ['<', '>'][0] 
fls = Folder.selectDialog().getFiles(gF); while(fls.length) open(fls.shift())

Likes

translate

Translate

Translate

Report

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
Most Valuable Participant ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

Had to add a try catch to ignore errors that happen in the gF function when the selected folder has folders and perhaps some none image files.

JJMack

Likes

translate

Translate

Translate

Report

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
Adobe Community Professional ,
Apr 17, 2021 Apr 17, 2021

Copy link to clipboard

Copied

try...catch statement is also necessary, because ExternalObject is not always reliable.

Likes

translate

Translate

Translate

Report

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