CS6 Error 8800 (textItem.color)

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

vladuha

CS6 Error 8800 (textItem.color)

Post by vladuha »

Hello!
This few lines of code still works in Photoshop CS5.1 but doesn't work in Photoshop CS6

Error image:


Error occur when:
1.Open new document
2.Create text
3.Select text
4.Run script

Error not occur:
When I do all the same but also applying color to text before script.

I want the color, being read, even if the user did not put the color

Code: Select allvar doc = activeDocument;
var layer = doc.activeLayer;

 var textColor = layer.textItem.color; 
 var Hex =  textColor.rgb.hexValue;   
 alert(Hex);

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Paul MR

CS6 Error 8800 (textItem.color)

Post by Paul MR »

Make sure you have installed all the updates for Photoshop CS6.
I had many problems with text that were then fixed by the updates.
vladuha

CS6 Error 8800 (textItem.color)

Post by vladuha »

Thank you Paul for reply. I was updated to the latest version, but unfortunately it didn't work for me.
vladuha

CS6 Error 8800 (textItem.color)

Post by vladuha »

I think I found the cause of the problem.
If default text color was black #000000 it doesn't work. But if previous color was dif from black color it works.
screenshot:


It can be fixed by adding this lines of code:
So if there is an error in color, make default text color black.

Code: Select all var doc = activeDocument;
 var layer = doc.activeLayer;
 
 try{                                                                                                             
 var textColor =  layer.textItem.color; 
  }
 catch(e){
    var  textColor = new SolidColor;
    textColor.rgb.red = 0;
    textColor.rgb.green = 0;
    textColor.rgb.blue = 0;
    }
    alert( textColor.rgb.hexValue);
But I think this is not the option, because it still works in PS5 without error handling.