Scripting: How to add my Photoshop script to the Bridge menu?
Copy link to clipboard
Copied
I have several scripts that work in Photoshop, but in some situations they get files from the bridge (via BridgeTalk ()). Everything works fine, but I would like to make it possible to call my script not only from Photoshop, but also from the Bridge menu (taking into account that the script has #target photoshop and located in the folder with Photoshop presets).
I found several examples, but all of them involve either adding a menu item or using the startup folder bridge (I still can’t figure out how to access this directory from the script itself (win + macos) to copy some fragment that calls the script , or through # target bridge (the menu is added while the script is running until the bridge is restarted)).
I am sure that someone was trying to solve the same problem, could you share ideas on how to do this better?
Explore related tutorials & articles
Copy link to clipboard
Copied
I'm not sure of an easy way to do that. I used to have a PS script that I could run from PS or Bridge. I've never had a lot of luck with Bridge talk, so my script didn't have it. What i did so was edit the main startup script for PS: photoshop.jsx. now i think they have the year in the name. This worked well, but i had to re-edit it every time a new major update to PS came out. What i did was basically copy part of that script that initiated another PS script like image processor, and just plugged in my info for my script.
Copy link to clipboard
Copied
not necessary to modify photoshop.js - just place the script that initializes the launch in \ Common Files \ Adobe \ Startup Scripts CC \ Adobe Photoshop \
There are no problems with manual copying, however, I wanted to automatically add the script to the menu - there are problems with access rights (the folder is writable only for administrators)
for example, code
var ss= new Folder ($.getenv ("COMMONPROGRAMFILES") + "/Adobe/Startup Scripts CC/Adobe Photoshop/")
alert (ss.create())
alerts "false" if user not administrator
Copy link to clipboard
Copied
Look at the sample scripts which ship with the Bridge SDK and also the glue scripts installed by Photoshop. They show clearly how to create Bridge menu items.
Copy link to clipboard
Copied
I made a test script and quite successfully created a menu item that calls the main script with the parameters I need. In this part I have no questions. The main problem at the moment is how to register this script so that it automatically fits into the bridge menu (and is always there). I found only ready-made examples when the script is already registered and placed by Startup Scripts, but I did not find how to make this placement 🙂
I think that I’ll just make an offer to the user to start Photoshop from the administrator account so that my script can copy the initialization module into Startup Scripts. But this decision seems to me not the best ...
UPD
var ss= new Folder ( $.getenv ("APPDATA") + "/Adobe/Bridge CC 2019/Startup Scripts")
on windows i can put scripts here, but question - how to correctly build bridge version folder (Bridge CC 2019) if i changes
Copy link to clipboard
Copied
There is no such thing as "registering." Your script has to go into one of the folders which are read by CC applications. From there it creates Bridge menu items.
Copy link to clipboard
Copied
I figuratively. "registering" == automatically copy jsx to startup scripts folder 🙂
I just originally planned that the main script itself would generate jsx to add to the bridge menu and write it to the startup scripts folder, however, it encountered restrictions on access rights. It turns out that it is difficult to refuse to manually copy the script launch module by the user. I took this situation into account and in case of access error to the folder, I will offer the user to transfer jsx independently.
Thank you all for your advice!
Copy link to clipboard
Copied
Probably you had to use non JavaScript method that will change access to folders in Properties / Security.

