textItem font Error 8500: The request property does not exist

Contributor ,
Mar 01, 2022 Mar 01, 2022

Copy link to clipboard

Copied

Hi All,

I got the below error for some of the files and working fine in some other files.

 

Screenshot 2022-03-02 at 12.54.18 PM.png

Code for reference

convertRXLayers(app.activeDocument);
function convertRXLayers(doc){
	
	for (var m = doc.layers.length-1; m >= 0; m--){
		
		var myLayerInvisible = 'FALSE'
		var theLayer = doc.layers[m];
		
		if(theLayer.visible == false) {
			myLayerInvisible = 'TRUE'
		}
		
		if (theLayer.typename === 'ArtLayer'){
			if(theLayer.kind == LayerKind.TEXT) { 
				//try{
					if(theLayer.textItem.font.indexOf("SFPro") > -1){//this line got error
						convertToShape(theLayer);
						if(myLayerInvisible === 'TRUE'){
							app.activeLayer = theLayer
							app.activeLayer.visible = false
						}
					}
			//	}catch(e){}
			}
			else{
				continue
			}
		}
		else{
			convertRXLayers(theLayer);
		}
	}
}

Thanks

TOPICS
Actions and scripting , macOS

Views

67

Likes

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 ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

Likes

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 ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

if(theLayer.textItem.font.indexOf("SFPro") > -1)

 

Any problem with the above code, actually I got the error on this line only, but it works for some of the file. Could you please anyone help me out?

Likes

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 ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

Check if my suggestion about using AM instead of DOM is not the solution.

Likes

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 ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

Hi Kukurykus,

 

Could you please share the AM code for getting the font names from the active document text layers?

 

Thanks

Likes

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 ,
Mar 02, 2022 Mar 02, 2022

Copy link to clipboard

Copied

LATEST

Analyzing scripts written for you should give you the answer:

Photoshop script to change the font for Superscript(In glyph) 

Likes

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