Adobe 12040118 Using Help - Page 187
Next we add a function to pop up error dialogs if there is a problem with any file we are attempting to import.
![]() |
UPC - 718659361808
View all Adobe 12040118 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 187 highlights
Help Using Help Examples Back 187 } return result; } Next we add a function to pop up error dialogs if there is a problem with any file we are attempting to import. function importSafeWithError (importOptions) { try { app.project.importFile (importOptions); } catch (error) { alert(error.toString() + importOptions.file.fsName); } } Next comes a function to actually import any image sequence that we discover using testForSequence(), above. Note that there is an option for forcing alphabetical order in sequences, which is commented out in the script as written. If you want to force alphabetical order, un-comment the line "importOptions.forceAlphabetical = true" by removing the two slashes at the beginning of that line. function processFolder(theFolder) { var files = theFolder.getFiles(); //Get an array of files in the target folder //test whether theFolder contains a sequence var sequenceStartFile = testForSequence(files); //if it does contain a sequence, import the sequence if (sequenceStartFile) { var importOptions = new ImportOptions (sequenceStartFile); //create a variable containing ImportOptions importOptions.sequence = true; //importOptions.forceAlphabetical = true; //un-comment this if you want to force alpha order by default importSafeWithError (importOptions); } //otherwise, import the files and recurse for (index in files) { //Go through the array, set each element to singleFile, run this: if (files[index] instanceof File) { if (! sequenceStartFile) { //if file is already part of a sequence, don't import it individually processFile (files[index]); //calls the processFile function above } } if (files[index] instanceof Folder) { processFolder (files[index]); // recursion } } } processFolder(targetFolder); Using Help Back 187
![](/manual_guide/products/adobe-12040118-using-help-afc463d/187.png)