Last active
January 26, 2022 00:10
-
-
Save MarshySwamp/064c052829fb35f1ab1014285090cb85 to your computer and use it in GitHub Desktop.
Open Selected Files from Folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* open selected files from folder */ | |
//community.adobe.com/t5/photoshop/open-selected-files/m-p/11632735 | |
var aFile = selectFile(true); | |
for (var i = 0; i < aFile.length; i++) { | |
open(File(aFile[i])); | |
} | |
////// select file ////// | |
function selectFile(multi) { | |
if (multi === true) { | |
var theString = "Please select the file or files:" | |
} else { | |
var theString = "Please select the file:" | |
} | |
if ($.os.search(/windows/i) != -1) { | |
var theFiles = File.openDialog(theString, '*.nef;*.cr2;*.crw;*.dcs;*.raf;*.arw;*.orf;*.dng;*.psd;*.tif;*.tiff;*.jpg;*.jpe;*.jpeg;*.png;*.bmp', multi) | |
} else { | |
var theFiles = File.openDialog(theString, getFiles, multi) | |
} | |
////// filter files for mac ////// | |
function getFiles(theFile) { | |
if (theFile.name.match(/\.(jpg|jpeg|tif|tiff|psd|psb|eps|png|bmp|gif)$/i) || theFile.constructor.name == "Folder") { | |
return true; | |
} | |
} | |
return theFiles | |
} | |
// or | |
/* | |
/* open selected files from folder */ | |
//community.adobe.com/t5/photoshop/open-selected-files/m-p/11632735 | |
selectFile = File.openDialog("Please select the file or files:", Multiselect = true); | |
for (var i = 0; i < selectFile.length; i++) { | |
var openFiles = app.open(File(selectFile[i])); | |
} | |
*/ | |
// or | |
/* | |
var openDialog = stringIDToTypeID( "open" ); | |
executeAction(openDialog, undefined, DialogModes.ALL); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment