Post by Bailey on May 25, 2019 4:56:22 GMT
Atm I am building a script (Javascript) for someone to use in PSE.
I have previously posted some scripts here on PSE&M and in them mentioned that you need something like Elements+ or another add-on that supports running Javascript.
This morning I was very pleasantly surprised when I accidentally found out that PSE (I am using PSE14) happily runs custom Javascript without the need for a Javascript supporting add-on.
I normally run my custom scripts via Elements+ but just out of curiosity, this morning I tried to open the Javascript file using PSE's File->Open command to see what happens. As I mentioned above, I was very pleasantly surprised to see that the script executed properly without any issues.
For anyone interested to see if Javascript runs in their PSE without needing an add-on, below is a quick and simple sample piece of Javascript code that will add a blank layer to the top of the layer stack of the currently active document in your PSE editor.
app.activeDocument.activeLayer = app.activeDocument.artLayers[0]; //set the top layer in stack as active layer
app.activeDocument.artLayers.add(); //add blank layer
app.activeDocument.activeLayer = app.activeDocument.artLayers[0]; //set the new layer as active layer
If you want to use this code, simply copy/paste it into any new text file using your favourite text editor. Personally I use the Netbeans IDE, but this would be gross overkill unless you are a web site developer. I would steer away from MS Word because any hidden/embedded formatting in the saved text file might cause the script to not run. Windows Notepad, Wordpad or the Mac. equivalents should be fine.
Save the text file anywhere you like on your PC with any name you like but make sure you give the filename a .jsx extension.
Open any image with at least one layer in your PSE editor.
Select File->Open
Then navigate to your .jsx file and select it.
If the script runs successfully, a new blank layer will appear at the top of your image file's layer stack.
The main advantage scripts have over actions is their immense power and flexibility. With scripting you can add logic to execute code only when certain conditions are met (files are a certain size, resolution, type etc etc etc) and script can be coded to run on only the active opened document or on all the documents in the Photo Bin in one go.
With scripting you can also run a script on all the image files in a particular folder or selected folders on your hard-drive.
There are many other advantages of scripting over actions as well.
So if you are familiar with Javascript, you can easily automate simple and complex PSE routine processing/editing tasks and save a lot of time through building your own custom dialog boxes for user inputs and you don't need any extra software or add-ons. All you need is a plain text editor to write/build the code (obviously you need to be familiar with Javascript or VBScript which PSE also supports).