Copy link to clipboard
Copied
I've been extracting Javascript from some Photoshop actions to use in my Applescripts, with no issues at all. This was all going well until I came across an export action I had setup, which doesn't want to work. I've run the extracted script on Photoshop 2020, and it works as it should. Trying to run the same script on Photoshop 2022 returns the following error...
Adobe Photoshop 2022 got an error: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. - Error 8800: General Photoshop error occurred. This functionality may not be available in this version of Photoshop. - The parameters for command “Export” are not currently valid. Line: 32 -> executeAction(cTID('Expr'), desc1, dialogMode);
I had a similar issue when using GUI methods a while back... older versions of Photoshop used 'Export Video', whereas it's now referred to as 'Export Image Sequence'. It's weird because I'm extracting the Javascript from Photoshop 2022, so you would assume this would be ok? I'm assuming the 'videoExport' part on Line 32 is no longer supported... Would anyone know what this might be referred to instead?
tell application "Adobe Photoshop 2022"
do javascript "cTID = function(s) { return app.charIDToTypeID(s); };
sTID = function(s) { return app.stringIDToTypeID(s); };
function VideoSequence() {
function step1(enabled, withDialog) {
if (enabled != undefined && !enabled)
return;
var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
var desc1 = new ActionDescriptor();
var desc2 = new ActionDescriptor();
desc2.putPath(sTID('directory'), new File('/Users/blah.blah/Desktop/'));
desc2.putString(sTID('subdirectory'), 'Test_Folder');
desc2.putString(cTID('Nm '), 'Test_File_.png');
var desc3 = new ActionDescriptor();
var desc4 = new ActionDescriptor();
desc4.putEnumerated(cTID('Mthd'), sTID('PNGMethod'), sTID('quick'));
desc4.putEnumerated(sTID('PNGInterlaceType'), sTID('PNGInterlaceType'), sTID('PNGInterlaceNone'));
desc4.putEnumerated(sTID('PNGFilter'), sTID('PNGFilter'), sTID('PNGFilterAdaptive'));
desc4.putInteger(cTID('Cmpr'), 6);
desc3.putObject(cTID('As '), sTID('PNGFormat'), desc4);
desc2.putObject(sTID('sequenceRenderSettings'), sTID('sequenceRenderSettings'), desc3);
desc2.putInteger(sTID('minDigits'), 4);
desc2.putInteger(sTID('startNumber'), 0);
desc2.putBoolean(sTID('useDocumentSize'), true);
desc2.putDouble(sTID('frameRate'), 15);
desc2.putBoolean(sTID('allFrames'), true);
desc2.putEnumerated(sTID('renderAlpha'), sTID('alphaRendering'), sTID('straight'));
desc2.putInteger(cTID('Qlty'), 1);
desc2.putInteger(sTID('Z3DPrefHighQualityErrorThreshold'), 5);
desc1.putObject(cTID('Usng'), sTID('videoExport'), desc2);
executeAction(cTID('Expr'), desc1, dialogMode);
};
step1(); // Export
};
VideoSequence.main = function () {
VideoSequence();
};
VideoSequence.main();"
end tell
Copy link to clipboard
Copied
Apologies, got the terminology the wrong way round... it used to be 'Render Image Sequence' but in Photoshop 2022 it's now referred to as 'Render Video'...
Copy link to clipboard
Copied
I'm edging closer to the solution... Opening Photoshop 2022 using Rosetta seems to fix the problem, although I'm going to keep digging to find a solution without having to enable it! :-S
Copy link to clipboard
Copied
So after a bit more research, I was initially correct after all... 'Render Image Sequence' is currently used on Photoshop 2022. However, when opening Photoshop 2022 using Rosetta, it reverts it back to the old terminology, 'Render Video', hence why the script only works when it's running in Rosetta!
Anyway, I've come up with a workaround, which is to follow the initial script but forcing the 'Render Image Sequence' dialog to load, and use GUI scripting to confirm the selection. To stop the above script from crashing, you need to enable the dialog by changing:
step1(); // Export
to...
step1(true, true); // Export
And, to ensure the dialog is confirmed, adding timeouts will allow for the script to error, which in turn will allow GUI scripting to kick in... In this case, pressing the 'Render' button.
tell application "Adobe Photoshop 2022"
try
with timeout of 1 second
do javascript "<insert javascript from initial post here, with the updated dialog bits mentioned in this post>"
end timeout
on error
tell application "System Events"
click button 8 of window 1 of process "Adobe Photoshop 2022"
delay 0.1
end tell
end try
end tell
Not the most poetic way of resolving the issue but if anyone has any methods to run this script without the need for GUI scripting, I'm all ears! 🙂
Copy link to clipboard
Copied
Photoshop on M1 doesn't support video unless run under Rosetta. So that's the ONLY way it will work.