Best Practices: Embedding Scripts in Actions

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

FairfieldPhoto

Best Practices: Embedding Scripts in Actions

Post by FairfieldPhoto »

I have a number of scripts that are embedded inside of actions and work fine.

The challenge I have is that I want to move those actions to other computers. I currently have to go back and re-specify the script location because the file paths are different across different (Windows 7) computers.

I have been storing the script files in a Dropbox folder that is accessible to all computers, but since Dropbox is set up off of "My Documents", the folder path to get to "My Documents" is different based on the User's name.

Are there any "Best Practices" as to where to put the .js/.jsx files so that the path would ALWAYS be the same regardless of what computer the action is called from?

Thanks!

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Best Practices: Embedding Scripts in Actions

Post by Mike Hale »

Xbytor's xtools has scripts that can be used to create an installer that can edit paths in an atn file to match the users system. It supports Mac and Windows. In fact the xtools installer uses that approach.
jjmacks

Best Practices: Embedding Scripts in Actions

Post by jjmacks »

Adobe changed the way scripts are recorded in actions a while back in the newer versions of Photoshop. If you browse to the script the script is recorder the old standard way in older versions of Photoshop the script whole path is recorded. Newer versions of Photoshop will only record script names if Photoshop list the script in its script list if not the old way is used and the path is recorded.

I run windows and add a shortcut to my Photoshop scripts tree. So I can save my script anywhere I want on my system and use them in all versions of Photoshop I have installed on my machine. If you do the same actions will only have script names no path. Script can be stored anywhere you want to. All you need do is link Photoshop script tree to your script tree by adding a shortcut to you tree in all your Photoshop trees presets\scripts\. When Photoshop starts it will run through its script tree and your scripts tree and build its script name list.
FairfieldPhoto

Best Practices: Embedding Scripts in Actions

Post by FairfieldPhoto »

I will dig into this. I am on CS6 and it recorded the script path (I am on Windows too). Maybe there is an option setting I am missing.

Thanks!

M
Mike Hale

Best Practices: Embedding Scripts in Actions

Post by Mike Hale »

I think jjmacks left out an important part. The script has to have a <javascriptresource> section for just the name recorded. Then both the name and the script's UUID is recorded as part of the action although only the name shows in the panel.

If the script doesn't have one the full path is recorded even if it is in the scripts folder. At least that is the way it works on Windows with Photoshop CC.
jjmacks

Best Practices: Embedding Scripts in Actions

Post by jjmacks »

Mike know way more the me. I'm only a hacker and my all my hacked scripts are javascript and have javascriptsource sections. I only got UUID for my scripts that are Photoshop plugins which are based on Adobe's Fit Image plugin source code. All I can say is my javascript Photoshop scripts that do not have UUID record in Actions as Script Name:"ScriptName" and the actions work.

I did not know the javascript source was required to have only the name recorded. While a UUID does not seem to be required using one would seem to be best to prevent dupe name entries. I have a version if Fit Image that has a different file name then Fit Image but its javascriptsourse states its name is Fit Image and it has a different UUID then Adobe Fit Image. Both get listed in Photoshop Automate list as fit image mine in a different section then Adobe's. I can use either in actions and the correct one will be used when the action plays. So if your going to make your script public including a UUID would be best.

From the guide I need to learn to read the manual.
<eventid> A unique string that identifies the event. Using a UUID will ensure that your script wont share this identifier with another script.
pedromarques

Best Practices: Embedding Scripts in Actions

Post by pedromarques »

I have a network of 15 non-administrator PC windows photo retouchers and I now I have manage to have a photoshop start script to automatically verify any new script update on my network (avoiding me to got to every PC).

Regarding the scripts within the actions, they are stored not on the scripts folder of the software but I am using the user account ID Public folder to store an daily updated copy of my central scripts (windows7) - C:\Users\Public\FolderScripts
This gives the chance to intall any script as non-administrator user rights, and I have succeed to work around the obligation of installing new scripts as an user administrator.

For 6 months it has been a great improvement for the team and it worked very well until now.

I will start to upgrade the scripts for CC as soon as possible, and in that sense I did not have the time to do so yet.
kpt

Best Practices: Embedding Scripts in Actions

Post by kpt »

I just wrote an installer which you can add to the beginning of your script. It installs a button in the action's palette which calls the script:

bb/viewtopic.php?f=13&t=5442