Skip to main content
Artbild-Fotografie
Participant
July 23, 2019
Answered

Syntax for Photoshop actions

  • July 23, 2019
  • 2 replies
  • 685 views

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!

This topic has been closed for replies.
Correct answer c.pfaffenbichler

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.

2 replies

c.pfaffenbichler
Community Expert
c.pfaffenbichlerCommunity ExpertCorrect answer
Community Expert
July 23, 2019

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.

July 23, 2019

Hi

There's the Photoshop Scripting forum

Stephen Marsh
Community Expert
Community Expert
July 23, 2019

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();