Skip to main content
Participant
September 14, 2013
Question

How to build a .ant file using scripts?

  • September 14, 2013
  • 1 reply
  • 1147 views

When I open Photoshop, and run the script, I want to establish an action, and record all actions of users, when I close the photoshop, the action can be save as a .ant file.

This topic has been closed for replies.

1 reply

JJMack
Community Expert
Community Expert
September 14, 2013

Remember all things you do in Photoshop can not be recorded. Xtools has some scripts that I believe can make scripts out of actions. And a Scripts also to made an Action file into XML code and an other make an Action out of xml code.  I see no Xtools script though that can make and action out of script code and that is understandable because script can contain logic and actions can not. 

However Scriptlistener script code does not have any logic everything is hard coded Action manager code no logic. So it may be possible to script converting scriptlistener code into an action. You may want to consider that approach for I do not think it is possibly to control the Action Palette with a Photoshop Script.

With that in mind the Scriptlistner basically does what you want to do.  It records everything that you do in Photoshop that is recordeable into Action Manager Script code. The Scriptlistener Plug-in also disables the Action's Pallette option that allows tool recording. So tool recording is not possible with the Scriptlistener plug-in installed. Recording tools IMO was not design and implemented well so its not all that useful. I feel it also has problems.   What the Scriptlistener lacks is recording controls everything recordeable is recorded and there is no record, and Stop buttons or an edit feature.

I'm a PC user so a created a little bat file that basically give me those missing scriptlistener features. There a bit crude but it works for me.  By modifying the scriptlistener JavaScript log file attribute I can prevent or allow writing a lock and unlock more or less. Therefore I have the ability to stop and start recording. The bat file can also clear the log and open the log with an editor. The log file attribute may also prevent the editor from saving the modified log however the bat file is a loop and the log can be unlocked for the bat runs independently from Photoshop and the editor.  A Photoshop Script can control the scriptlistener logs like my bat file.

So a script could clear the log lock and unlock to control recording. The Scriptlistener would record a script not and action. If you need it as an action you would need to write something to convert the Scriptlistener code into an Action.  I believe that may be possible for it all action manager code as unreadable as it is....

Here is my Bat file:

    @Echo Off

:loop

    CLS

rem Display Log File Size

    Dir "%USERPROFILE%\Desktop\ScriptingListenerJS.log" /T:W /4 | find "%ScriptingListenerJS.log"

rem Display Log Attributes  R read only Locked no R log is Unlocked

    Attrib "%USERPROFILE%\Desktop\ScriptingListenerJS.log"

Rem If timeout is use the above display lines will refresh over time else you need to use enter or number

    CHOICE /C 123456 /N /T 300 /D 6 /M "Enter:1 to Lock, 2 to Unlock, 3 to Edit, 4 to Clear, 5 To Exit :"

    Echo %ERRORLEVEL%

    if %ERRORLEVEL%==6 goto timeout

    if %ERRORLEVEL%==1 goto one

    if %ERRORLEVEL%==2 goto two

    if %ERRORLEVEL%==3 goto three

    if %ERRORLEVEL%==4 goto four

    if %ERRORLEVEL%==5 goto five

    goto loop

:timeout

    goto loop

:one

    Attrib +R "%USERPROFILE%\Desktop\ScriptingListenerJS.log"

    goto loop

:two

    Attrib -R "%USERPROFILE%\Desktop\ScriptingListenerJS.log"

    goto loop

:three

    Rem inline command use CMD independate command use start

    CMD /C notepad "%USERPROFILE%\Desktop\ScriptingListenerJS.log"

rem Start notepad "%USERPROFILE%\Desktop\ScriptingListenerJS.log"

    goto loop

:four

Rem If the script log file is unlocked not read only  this echo will clear it

    Echo. > "%USERPROFILE%\Desktop\ScriptingListenerJS.log"

    goto loop

:five

    EXIT


JJMack
Inspiring
September 14, 2013

So it may be possible to script converting scriptlistener code into an action.

There is: xtools/apps/ActionFileFromSLCode.jsx

I usually copy parts out of ScriptingListenerJS.log to another file then run the script.