I want too only import *.TGA And *.PSD
if I write
myFolder.getFiles('*psd*);
I get the PSD but how do I write a mask that include .tga??
-mads
getFiles(mask) how to??
Moderator: Paul Tuersley
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
According to the scripting guide you can use a function instead of a mask. Here's an example:
Paul T
Code: Select all
{
function testFiles(theFile) {
if (theFile.name.indexOf(".psd") != -1 || theFile.name.indexOf(".tga") != -1) {
return true;
}
}
var theFolder = folderGetDialog("Import Items from Folder...");
var filesArray = theFolder.getFiles(testFiles);
alert("There are " + filesArray.length + " valid files");
}
Last edited by Paul Tuersley on March 13th, 2005, 2:53 am, edited 2 times in total.
Thank you this works 
But I was wondering if it was possible to make a mask that included more than one file extension,something like:
myFolder.getFiles('*.tga'+'*.psd');
but I guess this isn´t possible?
-mads

But I was wondering if it was possible to make a mask that included more than one file extension,something like:
myFolder.getFiles('*.tga'+'*.psd');
but I guess this isn´t possible?
-mads
Sort of on this topic, how can you find the subfolders of a folder you picked with folderGetDialog()? mads, did you ever find out how to mask multiple file types? What if your extensions are all caps?