Skip to main content
Kogi18
Inspiring
February 14, 2019
Answered

Extendscript STARTUP folder location in /Users/<user> range

  • February 14, 2019
  • 4 replies
  • 5084 views

I wish to load at Photoshop startup a simple ExtendScript, which loads and stores some variables from the environment. The script itself is simple and already tested out to be working correctly, however I have troubles setting it up to run on Photoshop CC 2019 automatically at startup on MacOS Mojave. According to both ADOBE PHOTOSHOP CC SCRIPTING GUIDE 2019 and ADOBE PHOTOSHOP CC JAVASCRIPT SCRIPTING REFERENCE 2019 the script only needs to be placed inside the startup folder located at:

~/Library/Application Support/Adobe/Startup Scripts/

or we want to limit it to Photoshop only, then inside a separate folder:

~/Library/Application Support/Adobe/Startup Scripts/Adobe Photoshop/

However this seems to not be the case in MacOS Mojave at least. While it works in the general/global Library folder and its parent:

/Library/Application Support/Adobe/Startup Scripts/Adobe Photoshop/

It does not work from the user level library hierarchy (~/Library/Application Support/Adobe/Startup Scripts/). Actually in this hierarchy the folder Startup Scripts does not even exist. Creating the folder and placing them does no magic and it seems as if Photoshop only checks inside the global /Library. While for development that could work, for production level I would love to avoid the issue of writing permissions. The end goal is an automated script management system, which checks for updates of itself and other company scripts from a mounted network volume, therefore I wish to avoid using the global /Library hierarchy.

I checked online a few forums and between CS and CC versions there were constantly issues with user level startup scripts, where for each issues different alternative storing locations were presented, however none of those had yet worked for me.

Has anyone found a location, which does not require writing permissions to be changed for placing scripts to be run at startup?

Correct answer Tom Ruark

This is an error in the documentation. Only global /Library "Startup Scripts CC" is used on the mac. I'll update the documents.

4 replies

New Participant
January 18, 2025

I have a function that I want to run initially and repeat every 30 seconds. The task of the function is to get the active file in Photoshop and write it to a text file. I just couldn't implement the periodic timing every 30 seconds. How can I do this?

Tom Ruark
Tom RuarkCorrect answer
Inspiring
February 15, 2019

This is an error in the documentation. Only global /Library "Startup Scripts CC" is used on the mac. I'll update the documents.

Kukurykus
Brainiac
February 15, 2019

I don't use Mac, but what I understood it worked on OsX before some system update, so if I'm right Photoshop code should be adjusted to that change?

JJMack
Adobe Expert
February 14, 2019

Does your script conaint the BridgeTalk statment required in startup scripts folder

JJMack
Kogi18
Kogi18Author
Inspiring
February 15, 2019

No, since it should not be required. Since from my understanding it is just a simple string variable used in a if statement only to prevent other applications from executing the code inside the brackets. For a better understanding, here is the actual code I am testing right now:


var LOCAL_1 = $.getenv("L1");

var LOCAL_2 = $.getenv("L2");

if(LOCAL_1 == null || LOCAL_2 == null){

    alert("Environment variables not present, scripts will not load!");

}

alert("L1 [" + LOCAL_1 + "], L2 [" + LOCAL_1 + "]")

if(!Folder(L1).exists){

    // FUTURE CODE WILL BE HERE

}


As you can see the code is simplicity itself. Outside of Photoshop I setup environment variables L1 and L2, which I then read and report in current script. It works if I browse for the script manually in Photoshop or if I put it inside of

/Library/Application Support/Adobe/Startup Scripts/

or

/Library/Application Support/Adobe/Startup Scripts/Adobe Photoshop/

and restart Photoshop, which will trigger it on startup as I want.

The problem is the writing permissions required by the /Library hierarchy, which would for example for a bash script automated placement/copying require a sudo call, which I do wish to avoid for production level, which would be a script distribution across in the range of 100 employees.

According to the documentation using the ~/Library hierarchy should be possible but it seems that the provided location in the documentation does not work. So the question again, is there another user (~) range location that PhotoShop checks for startup scripts?

BTW, why can't I use the startup folder method (as you said in the previous post), since it is documented as a legit option and is also what I need to automate the process I wish to achieve?

Brainiac
February 15, 2019

Why do you need to run your script from any Startup Scripts folder?
Your script will be invoked on any call to other scripts, for example standard ones, such as Straighten.jsx for RullerTool and others. Do you need this?

The folders from which the scripts are run, I think, are made specifically with permissions. Otherwise, any virus can write there its code and get the rights of Photoshop, which can be run as administrator.

JJMack
Adobe Expert
February 14, 2019

Have you seteup a event handler  to launch your script when photoshop is started?  The Start Application event? Do not use the startup folder method. Run it in Photoshop after photoshop starts up and its up and ready for work. I do not know at what point in time Startup script in the statup folders are run.  Put the script in Photoshop's presets scripts foldet or a foldet you have linked Photoshop's presete scripts to.

JJMack