Copy link to clipboard
Copied
Since the latest update, previously working code containing the application Method 'charIDToTypeID' fails "charIDToTypeID is not a function".
Any ideas why and how to fix it? I have a LOT of functions that use it.
Also the error "ActionDescriptor does not have a constructor" is occurring in code that previously worked OK. Hopefully I can address that using Script Listener, but I do notice that it is showing changes (expansions) to the code from previous versions of PS.
FWIW, 'stringIDToTypeID' works OK.
PS 23.1.0
Win10
e.g.: var idslct = charIDToTypeID ( "slct" );
Copy link to clipboard
Copied
I don't experience this problem.
Copy link to clipboard
Copied
You show a 4 char code, the "usual" issue with three character codes missing the 4th empty character, such as 'All ' where the space is included as the 4th character.
Have you restarted Photoshop and or reset preferences?
Copy link to clipboard
Copied
All codes are four characters, padded with space(s).
Preferences reset, PS updated and restarted.
Still the same problem.
Copy link to clipboard
Copied
With 23.1.0 on Win10?
If so, grateful that you try this code, copied straight from ScriptingListenerJS.log:
// Code from ScriptListener
var idslct = charIDToTypeID( "slct" );
var desc269 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref7 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idRGB = charIDToTypeID( "RGB " );
ref7.putEnumerated( idChnl, idChnl, idRGB );
desc269.putReference( idnull, ref7 );
executeAction( idslct, desc269, DialogModes.NO );
If it works, I have a real puzzle.
Many thx.
Copy link to clipboard
Copied
Perhaps the problem is not in a separate function, but in the code around it. Can you post a snippet illustrating the problem?
Copy link to clipboard
Copied
I'm not getting an error with the snippet, however, it doesn't create a selection either. My file is RGB and I have tried both a flattened image and a targeted layer with content.
Copy link to clipboard
Copied
Make a mask before using the code.
Copy link to clipboard
Copied
That code does not create a selection, it selects the RGB Channel.
As to you getting no error, curiouser and curiouser (as Alice said). It's consistent on my system. Unfortunately I am unable to check the execution on my Mac. The Method definitely did not generate the error prior to the last two PS updates, it's used in a large number of my functions.
Copy link to clipboard
Copied
And how will that affect selection of the RGB channel? The Method is used in a large number of my functions, and errors in everyone I've tested. It did not error prior to the last two updates (which I did one after the other); I use scripts all the time and the majority call functions containing that Method.
Copy link to clipboard
Copied
I selected a colour channel and the script selects the RGB composite, no errors. Ran directly and also through VS Code ES Debugger. Running the code through Clean SL is the same, no errors in the converted function either.
EDIT: Also tested in CC2019 and CC2022, no issues (both on Mac).
selRGB();
function selRGB() {
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated( s2t( "channel" ), s2t( "channel" ), s2t( "RGB" ));
descriptor.putReference( c2t( "null" ), reference );
executeAction( s2t( "select" ), descriptor, DialogModes.NO );
}
Copy link to clipboard
Copied
My answer was to Stephen_A_Marsh if you wrote to me. Use Creative Cloud Cleaner tool.
Copy link to clipboard
Copied
Experimentation (including deleting and reinstalling software) indicates that the issue only occurs when the code is run from ExtendScript Toolkit CC. The script runs OK when started from PS.
I don't know what to make of that, because there have been no updates to ESTK for at least a couple of years. I reinstalled ESTK and the error remains. Very strange, but at least I can run the scripts from PS.
This has finally convinced me to switch to VS, so a learning experience ahead.
Thanks to all who made helpful suggestions.
Copy link to clipboard
Copied
Are you set "Adobe photoshop" target before run script or use #target photoshop directive in code?
Copy link to clipboard
Copied
So you did not solve the problem as before you started this thread your scripts worked ran from Ps, but not from ESTK. Do you use version 4.0.0.1, and did you try my Jan 11, 2022 suggestion?