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

Folder.userData is null?

Community Beginner ,
Jan 28, 2019 Jan 28, 2019

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
2.0K
Translate
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

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

Translate
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

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

Translate
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

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.

Translate
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

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

Translate
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

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)

Translate
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

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.

Translate
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

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

Translate
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

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)?

Translate
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

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? )

Translate
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

Did you find a solution for this?

Translate
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

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

Translate
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

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.

Translate
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
LATEST

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

Translate
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