What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

FileOpen filtring multiple filetypes at once?


SeniorS

Guru
Messages
1,747
Likes
520
Hello!

I start to playing with scripting a little and already stuck in 2 questions.
I want to make script for Indesign (i know that section is for PS but i think there is lots common) which place images one per page.
(i googled a little on those question but didn't find normal answer)

1. FileOpen with filter multiple filetypes at once. Like JPG, TIF etc. (images).
Instead i find out how to separate them all ("*.jpg, *.tif") but want to be able select all image types file at one dialog.

2. Creating new document.
Yes, i find how to create in script new document with all needed parametrs but i really want to do that later, at moment when script are running.
Does it makes sence?

Mostly it planned to use to restore lost book layouts rescan (some are unreadble, some are not even archived, some are named so badly that finding it will be longer than restoring).
So each book have diferent document size.


3. And final for moment. Is that posible to record Indesign? Didn't find clear answer for that question too. That would make all things easier.
Okey, find answer for that and not happy with it - NO! heh :(
 
Last edited:
Getting all file type in one go is full of danger!

Code:
var myFolder = Folder("~/desktop");
var fileList = myFolder.getFiles();
alert(fileList.length);
This will get you a list of all file and folders plus hidden files executables etc. etc
This is why getting all files is not a good idea.
this is much better as it will get a list of known photoshop files..
Code:
var myFolder = Folder("~/desktop");
var fileList = myFolder.getFiles(/\.(jpg|jpe|jpeg|gif|eps|dng|bmp|tif|tiff|psd|crw|cr2|rle|dib|cin|dpx|ps|pcd|pict|vda|icb|vst|wbm|sct|pbm|flm|psb|exr|pcx|pdp|nef|dcr|dc2|erf|raf|orf|tga|mrw|mos|srf|pic|pct|pxr|pdd|pef|png|x3f|raw)$/i);
alert(fileList.length);

Sorry I don't do anything with Indesign so can't help with that.
 
Oh...yes...thanks!

I don't want all files select and i'm am aware of script danger so i'm very cautious.
I couldn't figured out that "|" is for OR (and i really should quess that, now it looks obviously). Thanks again.
 

Back
Top