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
Copy link to clipboard
Copied
On PC it returns: ~/AppData/Roaming. Documentation says on Mac it's for: ~/Library/Application Support
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?
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.
Copy link to clipboard
Copied
There isn't one for Mac. Closest is $HOME but that will only get you: /Users/scott
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)
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.
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
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)?
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? )
Copy link to clipboard
Copied
Did you find a solution for this?
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
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.
Copy link to clipboard
Copied
If you are developing an extension you can use node.js to get the same information.