• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

c harIDToTypeID "is not a function"

Contributor ,
Jan 10, 2022 Jan 10, 2022

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" );

TOPICS
Actions and scripting , Windows

Views

317

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
LEGEND ,
Jan 10, 2022 Jan 10, 2022

Copy link to clipboard

Copied

I don't experience this problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2022 Jan 10, 2022

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 10, 2022 Jan 10, 2022

Copy link to clipboard

Copied

All codes are four characters, padded with space(s).

Preferences reset, PS updated and restarted.

Still the same problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 10, 2022 Jan 10, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 10, 2022 Jan 10, 2022

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 10, 2022 Jan 10, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 10, 2022 Jan 10, 2022

Copy link to clipboard

Copied

Make a mask before using the code.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 11, 2022 Jan 11, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 11, 2022 Jan 11, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2022 Jan 11, 2022

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 );
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 11, 2022 Jan 11, 2022

Copy link to clipboard

Copied

My answer was to Stephen_A_Marsh if you wrote to me. Use Creative Cloud Cleaner tool.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jan 12, 2022 Jan 12, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jan 12, 2022 Jan 12, 2022

Copy link to clipboard

Copied

Are you set "Adobe photoshop" target before run script or use #target photoshop directive in code?

2022-01-12_14-22-09.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 12, 2022 Jan 12, 2022

Copy link to clipboard

Copied

LATEST

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines