• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

File.hidden doesn't work as expected in Windows 10

New Here ,
Feb 13, 2017 Feb 13, 2017

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!

TOPICS
Actions and scripting

Views

681

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advisor , Feb 14, 2017 Feb 14, 2017

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

...

Votes

Translate

Translate
Adobe
Advisor ,
Feb 13, 2017 Feb 13, 2017

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 13, 2017 Feb 13, 2017

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Feb 14, 2017 Feb 14, 2017

Copy link to clipboard

Copied

LATEST

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))));
};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines