Copy link to clipboard
Copied
I've used a script listener to record the action but once copied across I can't get it to work,
I get the error Functionality may not be available. line 63
What could be the issue?
Or is the another workaround to getting the object to have an "auto"path?
The image is in 3 layers
Main Image
BACKGROUND
Original Image (invisible)
#target "photoshop"
// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc77 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref37 = new ActionReference();
var idmagicWandTool = stringIDToTypeID( "magicWandTool" );
ref37.putClass( idmagicWandTool );
desc77.putReference( idnull, ref37 );
var iddontRecord = stringIDToTypeID( "dontRecord" );
desc77.putBoolean( iddontRecord, true );
var idforceNotify = stringIDToTypeID( "forceNotify" );
desc77.putBoolean( idforceNotify, true );
executeAction( idslct, desc77, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc78 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref38 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref38.putProperty( idChnl, idfsel );
desc78.putReference( idnull, ref38 );
var idT = charIDToTypeID( "T " );
var desc79 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc79.putUnitDouble( idHrzn, idPxl, 17.000000 );
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc79.putUnitDouble( idVrtc, idPxl, 17.000000 );
var idPnt = charIDToTypeID( "Pnt " );
desc78.putObject( idT, idPnt, desc79 );
var idTlrn = charIDToTypeID( "Tlrn" );
desc78.putInteger( idTlrn, 2 );
var idMrgd = charIDToTypeID( "Mrgd" );
desc78.putBoolean( idMrgd, true );
var idAntA = charIDToTypeID( "AntA" );
desc78.putBoolean( idAntA, true );
executeAction( idsetd, desc78, DialogModes.NO );
// =======================================================
var idInvs = charIDToTypeID( "Invs" );
executeAction( idInvs, undefined, DialogModes.NO );
// =======================================================
var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );
var desc80 = new ActionDescriptor();
var idLvl = charIDToTypeID( "Lvl " );
desc80.putInteger( idLvl, 1 );
var idStte = charIDToTypeID( "Stte" );
var idStte = charIDToTypeID( "Stte" );
var identer = stringIDToTypeID( "enter" );
desc80.putEnumerated( idStte, idStte, identer );
var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
desc80.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idmodalStateChanged, desc80, DialogModes.NO );
// =======================================================
var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );
var desc81 = new ActionDescriptor();
var idLvl = charIDToTypeID( "Lvl " );
desc81.putInteger( idLvl, 0 );
var idStte = charIDToTypeID( "Stte" );
var idStte = charIDToTypeID( "Stte" );
var idexit = stringIDToTypeID( "exit" );
desc81.putEnumerated( idStte, idStte, idexit );
var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
desc81.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idmodalStateChanged, desc81, DialogModes.NO );
// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc82 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref39 = new ActionReference();
var idPath = charIDToTypeID( "Path" );
ref39.putClass( idPath );
desc82.putReference( idnull, ref39 );
var idFrom = charIDToTypeID( "From" );
var ref40 = new ActionReference();
var idcsel = charIDToTypeID( "csel" );
var idfsel = charIDToTypeID( "fsel" );
ref40.putProperty( idcsel, idfsel );
desc82.putReference( idFrom, ref40 );
var idTlrn = charIDToTypeID( "Tlrn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc82.putUnitDouble( idTlrn, idPxl, 0.500000 );
executeAction( idMk, desc82, DialogModes.NO );
When you use the scriptlistener plugin it records everything it can that you do in Photoshop. Sometimes you do not want all it records you just want some of what has been recorded. I find I do step for it to record that I need to set up conditions so what I want it to record can be recorded. Therefore extra things are recorded, I have to delete what I do not want The the stuff I do not want mad not even work in me script because conditions are not right for the step so it will not be availab
...Copy link to clipboard
Copied
When you use the scriptlistener plugin it records everything it can that you do in Photoshop. Sometimes you do not want all it records you just want some of what has been recorded. I find I do step for it to record that I need to set up conditions so what I want it to record can be recorded. Therefore extra things are recorded, I have to delete what I do not want The the stuff I do not want mad not even work in me script because conditions are not right for the step so it will not be available. Often I find I do not want some of the modalstatechanhe yje are recorded. Try to make sense of what is recorded use the required steps.
Copy link to clipboard
Copied
I've just gone through it again step by step making sure that I didn't do anything that was note required. but have worked out that the second last 2 blocks were not needed.
Many thanks
Copy link to clipboard
Copied
I use windows I control what the scriptlistener record by comtrolling the script log file readonly attribite. I use a BAT file to do that. It a windows that give you a choice of things to do the the log file. Lock, UnLock, Edit, Clear or end close the window.
@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