Copy link to clipboard
Copied
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?
This is an error in the documentation. Only global /Library "Startup Scripts CC" is used on the mac. I'll update the documents.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Does your script conaint the BridgeTalk statment required in startup scripts folder
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
I require it since we wish to automate the script versioning and updating based on our trusted network source. We are not talking about RulerTool script and similar, but more in the area of export scripts, where we wish to correctly export files in a designed network hierarchy the company uses for projects. Therefore it is essential to have the changes in hierarchy and similar be updated in our ExtendScripts in an automated and transparent matter, while not requiring the end users (artists) to have to endure each time a complex process they may not understand why it is needed.
The current direction of development wishes to take use of the practicality of startup scripts. I am only asking if the option inside the user's Library is still a valid option as it is documented in the documentation or if the documentation is simply not correctly updated.
Copy link to clipboard
Copied
How does you script not work if it works in Photoshop. Have you tried installing it in Photoshop as a start application event handler.
Copy link to clipboard
Copied
Dear JJMack, the problem is that Photoshop does not read the scripts from the startup folder, even though the documentation states it should. While it of course works by setting up an application event, that was not the actual answer I was searching for. However it helped me find an alternative "hack". The idea is to generate Script Event Mangers local settings by a script. Luckily for CC 2019 Photoshop it seems that Script Event Manger stores added events in
~/Library/Preferences/Adobe Photoshop CC 2019 Settings/Script Events Manager.xml
however this are only the dropdown events, while the added or activated script events seem to be stored inside a neighbouring file
~/Library/Preferences/Adobe Photoshop CC 2019 Settings/tw0001.dat
Since both are located inside the ~/Library, I can use this for our automation script in such way, that I create or modify the tw0001.dat file to include the path to the our startup script (for example via bash script) with no permission issues.
However this "hack" has its own problems. First I do not know if this file is consistent across photoshop versions or even inside the same version (maybe its name is localised etc.), not to mention future versions may change it again. Therefore I would still prefer the officially documented way for creating startup scripts, where you only need to place them in a specified folder. Hopefully the Adobe ExtendedScript support team will soon return me a positive answer.
Copy link to clipboard
Copied
Hopefully the Adobe ExtendedScript support team will soon return me a positive answer.
I wish you best, but the reality is far away from our expectations when user-staff cooperation is taken into consideration.
Copy link to clipboard
Copied
You claim that your startup script does not start.
There is a file on Windows
"C:/\Program Files (x86)/Common Files/Adobe/Startup Scripts CC/Adobe Photoshop/photoshop_v2019.jsx"
Do you have a similar file anywhere? Or did I not understand something?
Copy link to clipboard
Copied
I think you misunderstood me, but yes I know of it also on MacOS, its located at
/Library/Application Support/Adobe/Startup Scripts CC/Adobe Photoshop/
However notice that it is the GLOBAL /Library not the user level/range ~/Library. The difference is in write permissions for programs or user (think of sudo). Imagine being an artist and always being required to "login" again when you open Photoshop. That is why a User has his own Library in his home location to store presets which should not impact the system too much.
And sadly while the hierarchy
~/Library/Application Support/Adobe/
exists, it does not contain the subfolders Startup Scripts CC/Adobe Photoshop/, which means Adobe or Apple changed sthg and it did not get corrected yet in the 2019 CC version or its documentation.
Copy link to clipboard
Copied
All I know is that every Photoshop startup script I see installed on my system seems to have work and they all have if BridgeTalk statements like the Scripting manual refers to which you state is not required. Do other Startup scripts installed on your system work. Adobe seems to install some startup Photoshop scripts. I have never written a startup script myself.
Copy link to clipboard
Copied
This is an error in the documentation. Only global /Library "Startup Scripts CC" is used on the mac. I'll update the documents.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Why not fix Mac Photoshop to work like Windows Photoshop instead of documentine it don't work like that on macs.
Copy link to clipboard
Copied
https://forums.adobe.com/people/Tom+Ruark
I'll update the documents.
Copy link to clipboard
Copied
Do not really understand the problem.
For example, on Windows in folder Startup Scripts XX we can make a symbolic link to any file in any other folder without restrictions and then change the file as we like.
Is it possible on a Mac?
If so, will this solve the problem?
Copy link to clipboard
Copied
Well a symbolic link can be added, but this still requires (root) permissions for link creation.
The issue was that the documentation listed an option of adding startup scripts in User's ~/Library, where as the user we would already have all needed writing permissions. But as it turns out, that is not actually the case. Adobe now clarified, that it is an issue of outdated documentation, may it be due to security issues as mentioned in a previous post or some other reasons .
Since only global locations are used by Photoshop on MacOS for startup as well as preset scripts, we will scratch the current concept and try something else like symbolic links or other workarounds for our automated process.
Thank you all for the feedback, the official answer came faster than expected.
Copy link to clipboard
Copied
You got simply luck - what I noticed Tom Ruark visits this forum on Fridays