Copy link to clipboard
Copied
Hi! Is there a syntax for photoshop actions for writing them myself with code only and without having to record them in Photoshop?
If there is one, I am having trouble finding it. Please point me the right direction.
Thank you very much & have a great day!
1 Correct answer
Photoshop Scripting can be done with JavaScript, Visual Basic and AppleScript and offers options that go beyond plain Actions, so as Ged Traynor and Stephen_A_Marsh recommended you may want to look into that.
Edit: JavaScript is the only platform-independent language among the three so it is the preferred one.
Explore related tutorials & articles

Copy link to clipboard
Copied
Hi
There's the Photoshop Scripting forum
Copy link to clipboard
Copied
Actions are intended to be recorded. That being said, xbytor's xtools does offer an action to XML and XML to action conversion script. Writing actions manually as XML would be tortuous though IMHO, as you would have to reverse engineer actions to work out the format.
As Ged mentioned, you should probably look into scripting as an alternative.
xtools here:
https://sourceforge.net/projects/ps-scripts/files/xtools/v2.3/
The above three step action, select all + copy + paste is a 27 line XML file using xbytor's script. In order for the XML to action script to convert the manually written file to an action, you would have to get the XML correct.
<ActionFile key="Action4.atn" file="/private/var/folders/qn/j2dj8gf53ys13x9tqgh59h880000gq/T/TemporaryItems/Action4.atn">
<ActionSet version="16" name="Action4" expanded="false" count="1">
<Action key="1" name="Action 4" expanded="false" count="3">
<ActionItem key="TEXT" expanded="false" enabled="true" withDialog="false" dialogOptions="2" identifier="TEXT" event="set" name="Set" hasDescriptor="true">
<ActionDescriptor key="set" count="2">
<DescValueType.REFERENCETYPE key="1853189228" id="1853189228" symname="Null" sym="null">
<ActionReference key="1853189228" id="1853189228" symname="Null" sym="null" count="1">
<ReferenceFormType.PROPERTY key="1130917484" id="1130917484" symname="Channel" sym="Chnl" desiredClassString="Channel" desiredClass="Chnl" property="1718838636" propertyName="selection" propertySym="selection"/>
</ActionReference>
</DescValueType.REFERENCETYPE>
<DescValueType.ENUMERATEDTYPE key="1411391520" id="1411391520" symname="To" sym="T " enumeratedTypeString="Ordinal" enumeratedType="Ordn" enumeratedValueString="All" enumeratedValue="Al "/>
</ActionDescriptor>
</ActionItem>
<ActionItem key="TEXT" expanded="false" enabled="true" withDialog="false" dialogOptions="2" identifier="TEXT" event="copyEvent" name="Copy" hasDescriptor="false"/>
<ActionItem key="TEXT" expanded="false" enabled="true" withDialog="false" dialogOptions="2" identifier="TEXT" event="paste" name="Paste" hasDescriptor="true">
<ActionDescriptor key="paste" count="2">
<DescValueType.ENUMERATEDTYPE key="1097757761" id="1097757761" symname="AntiAliasedPICTAcquire" sym="AntA" enumeratedTypeString="AntiAlias" enumeratedType="Annt" enumeratedValueString="AntiAliasNone" enumeratedValue="Anno"/>
<DescValueType.CLASSTYPE key="1098063904" id="1098063904" symname="As" sym="As " classString="Pixel" class="Pxel"/>
</ActionDescriptor>
</ActionItem>
</Action>
</ActionSet>
</ActionFile>
Whereas with scripting using ExtendScript/JavaScript, the equivalent lines of "DOM" code would be:
app.activeDocument.selection.selectAll();
app.activeDocument.selection.copy();
app.activeDocument.paste();
app.activeDocument.selection.deselect();
Copy link to clipboard
Copied
Photoshop Scripting can be done with JavaScript, Visual Basic and AppleScript and offers options that go beyond plain Actions, so as Ged Traynor and Stephen_A_Marsh recommended you may want to look into that.
Edit: JavaScript is the only platform-independent language among the three so it is the preferred one.

