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

Folder.userData is null?

Community Beginner ,
Jan 28, 2019 Jan 28, 2019

Copy link to clipboard

Copied

Hi,

I have a simple script which I am trying to get the value of the the userData attribute to write a file.  Any idea why Folder.userData on Mac Mojave system would return null?  This on a Mac Mojave system (10.14.2)

Thanks in advance, Scott

TOPICS
Actions and scripting

Views

1.4K

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
Adobe
LEGEND ,
Jan 28, 2019 Jan 28, 2019

Copy link to clipboard

Copied

On PC it returns: ~/AppData/Roaming. Documentation says on Mac it's for: ~/Library/Application Support

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
Community Beginner ,
Jan 28, 2019 Jan 28, 2019

Copy link to clipboard

Copied

Yes that is what it should be doing. But why is it returning null is my question.  Is it some sort of permission issue?

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
LEGEND ,
Jan 28, 2019 Jan 28, 2019

Copy link to clipboard

Copied

For PC there is wrote: %USERDATA% (by default, C:\Documents and Settings\username\Application Data)

I have no idea what's equivalent for %USERDATA% on OSX, but if there is some, see what it returns, used directly form SO.

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
Community Beginner ,
Jan 28, 2019 Jan 28, 2019

Copy link to clipboard

Copied

There isn't one for Mac.  Closest is $HOME but that will only get you:  /Users/scott

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
Advocate ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

Folder.userData should resolve to ~/Library/Application Support/ (or if you get it as URL ~/Library/Application%20Support)

What you could do is get ExtendScript Toolkit, and hook it up with your Photoshop version, and run (for example) the following script:

alert(Folder.userData)

Photoshop should then come to the foreground and display an alert containing the path.

It is, however, possible that the error is caused by Apple's messing around with interapplication communication in 10.14 (and it is getting worse and worse with every new version)

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
LEGEND ,
Jan 30, 2019 Jan 30, 2019

Copy link to clipboard

Copied

I am on PC but when once I wanted to adjust script for OsX user I found there is problem with Folder.startup as well.

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
Community Beginner ,
Jan 31, 2019 Jan 31, 2019

Copy link to clipboard

Copied

Doesn't look like ExtendScript Toolkit works with modern versions of MacOS.  I did create a simple script which has the alert(Folder.userData) and placed into the scripts directory.  When I run it from Photoshop CC 2019 on macOS Mojave it returns "null".

I've even went into the Mac's Privacy settings and:

- verified accessibility was enabled

- gave Photoshop CC 2019 full disk access

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
Advocate ,
Feb 01, 2019 Feb 01, 2019

Copy link to clipboard

Copied

I have 10.14 on a virtual machine, and I will check it out shortly.

However, what happens when you run the script directly from ExtendScript Toolkit (and not saved and out of Photoshop)?

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
People's Champ ,
Feb 01, 2019 Feb 01, 2019

Copy link to clipboard

Copied

You can also try.

alert(Folder.userData + "\n\n" + $.getenv("APPDATA"));

Only I do not know the analogue of the name "APPDATA" for MacOS

Maybe you know? )

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
Engaged ,
Aug 02, 2023 Aug 02, 2023

Copy link to clipboard

Copied

Did you find a solution for this?

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
Community Expert ,
Aug 03, 2023 Aug 03, 2023

Copy link to clipboard

Copied

It works for me

 

alert(Folder.userData);

// or

alert(Folder.userData.fsName);

// or

alert(Folder.userData.fullName);

 

~/Library/Application%20Support

 

/Users/username/Library/Application Support

 

~/Library/Application Support

 

Ps 2021 on Monterey 12.6.8 Intel Chip

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
People's Champ ,
Jul 08, 2024 Jul 08, 2024

Copy link to clipboard

Copied

The issue seems to be when the user is using OneDrive to backup their desktop. I've also seen this with users that are using Sharepoint.

In those cases, all the Folder paths in Extendscript return null.

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
Engaged ,
Aug 28, 2024 Aug 28, 2024

Copy link to clipboard

Copied

LATEST

If you are developing an extension you can use node.js to get the same information.

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