Skip to main content
Known Participant
May 8, 2018
Question

Load and activate Presets through script?

  • May 8, 2018
  • 2 replies
  • 4286 views

Hello everybody, I am new to scripting and I am trying to load some presets (actions, brushes, styles, shapes) in order to be the active/default sets in Photoshop.
I have managed to do it with the ScriptListener, but he "follows" the exact path of my computer in order to load and activate the presets. Of course that will cause problems once the script is used outside my computer.

I have managed to direct the script to read the preset folder without following the exact local path (example: app.path+'/Presets/Actions/ActionsSet.atn), but how to activate this set as the default set for the user?

Any help will be appreciated!

This topic has been closed for replies.

2 replies

Participating Frequently
May 9, 2018

Bonjour

Maybe you can create, save appropriate workspaces and then call them ?

And see HERE

Known Participant
May 9, 2018

Bonjour Dominique!

Thank you for you comment. Indeed the Workspace installation is something that also bugs me, I was going to create a batch file for that, but I will try and use your idea instead.

The reason I would like to bring those assets (brushes, actions, styles & C.Shapes) as defaults with a script is that even-though someone has a Workspace with specific panels and sets selected in Photoshop, once the program crashes or the computer shuts down unexpectedly, the sets are gone and I have to re-bring them as defaults (happens a lot with Actions). That's why I need a script that brings everything back. It will make user's life easier.

Merci!

Participating Frequently
May 9, 2018

I use 3 workspace backups with keyboard shortcuts and tools!
And I'm using this one to reset everything to zero :

// =======================================================
var idslct = charIDToTypeID( "slct" );
    var desc1 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref1 = new ActionReference();
        var idworkspace = stringIDToTypeID( "workspace" );
        ref1.putName( idworkspace, "HUN" );
    desc1.putReference( idnull, ref1 );
executeAction( idslct, desc1, DialogModes.NO );

Known Participant
May 8, 2018

Hey it's me again. I figured out how to load a preset through a better path and I hope that will help someone else.

Lets say that I want to load a set of Actions (ActionsSet.atn):

function myActions() {

var newActionsPath = app.path+'/Presets/Actions/ActionSet.atn';

app.load(new File(newActionsPath);

}

myActions();

That will load the appropriate preset to user's Photoshop no matter the version of Ps or the architecture of the computer (PC, MAC). But I need a couple of things in case somebody knows. How can I make a "load and replace" instead of just "load" (specially for styles and custom shapes) and how to make an "if" statement to check if the presets are already loaded and not load them again.

Thank you in advance!

Inspiring
May 8, 2018
Known Participant
May 8, 2018

Thank you for your help my friend but this scrips unloads the action set, doesn't load action sets or check for an already loaded action set.