0

I get this error: test.scpt: script error -41. Couldn't get error text because of error -1700.

AppleScript contents:

tell application "Adobe Photoshop CC 2019"
activate
set js to "#include '/Users/temp_myname/My Application/tmp/Adobe Scripts/script.jsx';" & return
delay 3
do javascript js
end tell

JSX script contents:

#target photoshop
var err = "";
app.bringToFront();
app.displayDialogs = DialogModes.ERROR;
var fileRef = new File("/Users/temp_myname/My Application/tmp/10.20.5.18/default_10/Images/889original.jpg");
try{
open(fileRef);
} catch (Error) { err = Error }
;fileRef = null;
var errorFile = new File("/Users/temp_myname/My Application/tmp/Adobe Scripts/psperr.txt");
errorFile.open("w");
errorFile.write(err);
errorFile.close();
errorFile = null;

function runMenuItem(item) {
cTID = function(s) { return app.charIDToTypeID(s); };var desc = new ActionDescriptor();var ref = new ActionReference();ref.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), item );desc.putReference( cTID( "null" ), ref );executeAction( cTID( "slct" ), desc, DialogModes.NO );
}

OSX Version: 10.14.6

How can this script generate the error code -1700? the same script works on another Mac (with the same configuration) just fine.

What does -41 mean? I can't find it in the reference table:

Error Numbers and Error Messages

From that page I got the description for error code -1700:

Bad parameter data was detected or there was a failure while performing a coercion.

I checked the file permissions, reset the Finder, disabled the virusscanner, unmounted volumes... I also added the osascript and extendscript executables to the system security settings.

What do you think? How can I make this work?

BTW. I run the AppleScript from a Java application that uses OpenJDK, like this:

Runtime rt = Runtime.getRuntime();
Process proc;
String[] process;

process = new String[2];
process[0] = "osascript";
process[1] = "/Users/temp_myname/My Application/tmp/Adobe Scripts/test.scpt";
proc = rt.exec(process);
extremecoder85
  • 119
  • 1
  • 12
  • Are you hiding something or does it literally say `Users/temp_myname/My Application/tmp/Adobe Scripts/script.jsx`? – matt May 06 '20 at 12:31
  • I obscured the real path and username, but it's in the same format. – extremecoder85 May 06 '20 at 12:36
  • Well if you’re going to lie to us the problem could be anywhere. I suggest debugging. Delete lines until it runs without error and then slowly start putting them back again. – matt May 06 '20 at 12:39
  • Funny thing is that when these scripts are ran from the script debugger they just work. EDIT: Added info about how the script is executed. – extremecoder85 May 06 '20 at 12:46

1 Answers1

0

This has been fixed. The trick is to add a sleep between the execution of two such AppleScripts.

Error code -41 is an OSX error code that can be found in MacErrors.h: mFulErr = -41, /memory full (open) or file won't fit (load)/

extremecoder85
  • 119
  • 1
  • 12