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

Extendscript and Absolute Paths for folders in home directory?

Explorer ,
Nov 14, 2023 Nov 14, 2023

Copy link to clipboard

Copied

I'm using PS2022 and PS2024 for testing on MacOS Ventura 13.6.

For some reason, Extendscript is not treating /Users/USERNAME/Desktop/FOLDER as an absolute path. This code (with a valid path) returns false when checking folder.exists:

var folder = new Folder('/Users/USERNAME/Desktop/FOLDER');
var files = folder.getFiles();

// Check if the folder exists
if (folder.exists) {
    alert("Folder exists.");
} else {
    alert("Folder does not exist.");
}

 

If the path is changed to this, then folder.exists returns true:

 

var folder = new Folder('/Volumes/Macintosh HD/Users/USERNAME/FOLDER');


When I use the function 'Folder.selectDialog' I get a string like the path in the first example - without Volumes/Drive - which should be a valid absolute path. In my previous testing it worked fine, but that was on a different machine.

 

If I need the Drive info in the path, how can I grab that?

Thanks in advance!

 

TOPICS
Actions and scripting , macOS

Views

201
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
Adobe
Community Expert ,
Nov 14, 2023 Nov 14, 2023

Copy link to clipboard

Copied

LATEST

Just curious why you aren't using the more common relative path to the desktop?

 

'~/Desktop/FOLDER'

Votes

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