Copy link to clipboard
Copied
G'day all!
First post here, so I'll get right to the point. My script uses Folder.selectDialog, then Folder.getFiles() w/o any arguments.
I follow that up with a loop
if (fileList[0] instanceof Folder || fileList[0].hidden == true){};
File.hidden mentions the "platform-specific file browser" and this loop works perfectly at work on Mac OSX Sierra but fails miserably at home on Windows 10. I've had to add a second means of eliminating files that begin with "._" to clear out normally hidden files that follow photos from the OSX machine.
Is that just a fact of life on a Windows 10 machine with files copied from a Mac?
Thanks in advance!
I checked my code and I also have a check for '._' at the beginning of the file name (file.name.slice(0, 2) == '._'). I only check for the hidden property when I actually have a file to process.
Here's code that I use for determining whether a file is a valid image file.
// Function: winFileSelection
// Description: Determines if a File is an image file (checks file extension)
// Input: f - File
// Return: true if f is an image file, false if not
//
psx.winFileSelection = function(f) {
var suffix = f
Copy link to clipboard
Copied
In Explorer on Win10, open the properties dialog on the File/Folder and see what it says. Finder may be hiding the files because it's a Mac thing.
Copy link to clipboard
Copied
yeah, i toggled that and am used to seeing them and deleting manually. But it doesn't look like they return true to Folder.hidden even when non-visible.
Thanks!
Copy link to clipboard
Copied
I checked my code and I also have a check for '._' at the beginning of the file name (file.name.slice(0, 2) == '._'). I only check for the hidden property when I actually have a file to process.
Here's code that I use for determining whether a file is a valid image file.
// Function: winFileSelection
// Description: Determines if a File is an image file (checks file extension)
// Input: f - File
// Return: true if f is an image file, false if not
//
psx.winFileSelection = function(f) {
var suffix = f.name.match(/[.](\w+)$/);
var t;
if (suffix && suffix.length >= 2) {
suffix = suffix[1].toUpperCase();
for (t in app.windowsFileTypes) {
if (suffix == app.windowsFileTypes
// Ignore mac-generated system thumbnails
if (f.name.slice(0,2) != "._") {
return true;
}
}
}
}
return false;
};
//
// Function: macFileSelection
// Description: Determines if a File is an image file (by file type/extension)
// Input: f - File
// Return: true if f is an image file, false if not
//
psx.macFileSelection = function(f) {
var t;
for (t in app.macintoshFileTypes) {
if (f.type == app.macintoshFileTypes
return true;
}
}
// Also check windows suffixes...
return psx.winFileSelection(f);
}
psx.isValidImageFile = function(f) {
return ((f instanceof File) &&
(((File.fs == "Macintosh") && psx.macFileSelection (f)) ||
((File.fs == "Windows") && psx.winFileSelection(f))));
};