Getting weird error: "General Photoshop error occurred".

Hi Guys,
I am trying to get the info(font, color, alignment etc.)  of text kind layer in Photoshop CC. My script is as follows,
var textLayer = activeDocument.activeLayer.textItem;
var fontName = textLayer.font;
try{
     var textColor = "R: " + textLayer.color.rgb.red + " G: " + textLayer.color.rgb.green + " B: " + textLayer.color.rgb.blue;
catch(e){alert(e);}
try
     var textAlignment = textLayer.justification.toString();
catch(e){alert(e);}
On setting the color value R - 0, B - 0 and G - 0 or alignment 'Left' and create a text layer after this. I encountered an error
"Error: General Photshop error occurred. This functionality may not be available in this version of Photoshop.
     - <no additional information available> "
If I set some other color value and other alignment and create the text and get its info, script works fine.
Or If I change the values and revert it back to 'Left' alignment and R-0, B-0 and G-0 then I am able to get the values with the above script.
I get this error at first time only and after that script works fine
I also run this script with CS5 version, Its working fine there. But I don't know why I am getting this error in CC version.
Am I doing something wrong here or Is it some issue with Photoshop CC.
Any help would be appriciated.
Thanks..

Is your text layer using a layer style? If so, this routine should find the font and color in use.
var fontsInUse = [];
var colorsInUse = [];
if ( documents.length > 0 ) {
    GetFontUsage( activeDocument.layers, fontsInUse );
          alert( fontsInUse );
    GetColorUsage( activeDocument.layers, colorsInUse );
          alert( colorsInUse );
} else {
          alert( "Please open a document." );
function GetFontUsage( l, f ) {
    for ( var i = 0; i < l.length; i++ ) {
        if ( l[i].typename == "LayerSet" ) {
            GetFontUsage( l[i].layers, f );
        } else if ( l[i].typename == "ArtLayer" && l[i].kind == LayerKind.TEXT  ) {
            try {
                f.push( l[i].textItem.font );
            catch(e) {
                f.push( GetFontUsageFromDescriptor( l[i] ) );
function GetColorUsage( l, f ) {
    for ( var i = 0; i < l.length; i++ ) {
        if ( l[i].typename == "LayerSet" ) {
            GetFontUsage( l[i].layers, f );
        } else if ( l[i].typename == "ArtLayer" && l[i].kind == LayerKind.TEXT  ) {
            try {
                f.push( Math.round(l[i].textItem.color.rgb.red) + ":" +
                        Math.round(l[i].textItem.color.rgb.green) + ":" +
                        Math.round(l[i].textItem.color.rgb.blue));
            catch(e) {
                f.push( GetColorUsageFromDescriptor( l[i] ) );
// text layer probably has a layer style
// we will try to select the layer
// pull the descriptor
// and see if we can find a font
function GetFontUsageFromDescriptor( l ) {
    var layerFontName = "";
    var lastActive = activeDocument.activeLayer;
    activeDocument.activeLayer = l;
    var ktextKeyStr = stringIDToTypeID("textKey");
          var ref = new ActionReference();
          ref.putProperty(charIDToTypeID('Prpr'), ktextKeyStr);
          ref.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'),
                                                                                                                                  charIDToTypeID('Trgt'));
          var desc = executeActionGet(ref);
          if ( desc.hasKey( ktextKeyStr ) ) {
                    var descText = desc.getObjectValue( ktextKeyStr );
        var kparagraphStyleRangeStr = stringIDToTypeID( "paragraphStyleRange" );
        if ( descText.hasKey( kparagraphStyleRangeStr ) ) {
            var paraList = descText.getList(  kparagraphStyleRangeStr );
            var kparagraphStyleStr = stringIDToTypeID("paragraphStyle");
            var paraDesc = paraList.getObjectValue( 0 );
            if ( paraDesc.hasKey( kparagraphStyleStr ) ) {
                var paraStyle = paraDesc.getObjectValue( kparagraphStyleStr );
                var kdefaultStyleStr = stringIDToTypeID("defaultStyle");
                if ( paraStyle.hasKey( kdefaultStyleStr ) ) {
                    var defStyle = paraStyle.getObjectValue( kdefaultStyleStr );
                    var kfontPostScriptNameStr = stringIDToTypeID("fontPostScriptName");
                    if ( defStyle.hasKey( kfontPostScriptNameStr ) ) {
                        layerFontName = defStyle.getString( kfontPostScriptNameStr );
    activeDocument.activeLayer = lastActive;
    return layerFontName;
// text layer probably has a layer style
// we will try to select the layer
// pull the descriptor
// and see if we can find a color
function GetColorUsageFromDescriptor( l ) {
    var layerColor = "";
    var lastActive = activeDocument.activeLayer;
    activeDocument.activeLayer = l;
    var ktextKeyStr = stringIDToTypeID("textKey");
          var ref = new ActionReference();
          ref.putProperty(charIDToTypeID('Prpr'), ktextKeyStr);
          ref.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'),
                                                                                                                                  charIDToTypeID('Trgt'));
          var desc = executeActionGet(ref);
          if ( desc.hasKey( ktextKeyStr ) ) {
                    var descText = desc.getObjectValue( ktextKeyStr );
        var kparagraphStyleRangeStr = stringIDToTypeID( "paragraphStyleRange" );
        if ( descText.hasKey( kparagraphStyleRangeStr ) ) {
            var paraList = descText.getList(  kparagraphStyleRangeStr );
            var kparagraphStyleStr = stringIDToTypeID("paragraphStyle");
            var paraDesc = paraList.getObjectValue( 0 );
            if ( paraDesc.hasKey( kparagraphStyleStr ) ) {
                var paraStyle = paraDesc.getObjectValue( kparagraphStyleStr );
                var kdefaultStyleStr = stringIDToTypeID("defaultStyle");
                if ( paraStyle.hasKey( kdefaultStyleStr ) ) {
                    var defStyle = paraStyle.getObjectValue( kdefaultStyleStr );
                    var kColorStr = stringIDToTypeID("color");
                    if ( defStyle.hasKey( kColorStr ) ) {
                        var colorDesc = defStyle.getObjectValue( kColorStr );
                        layerColor += Math.round( colorDesc.getInteger( stringIDToTypeID("red" ) ) ) + ":";
                        layerColor += Math.round( colorDesc.getInteger( stringIDToTypeID("green" ) ) ) + ":";
                        layerColor += Math.round( colorDesc.getInteger( stringIDToTypeID("blue" ) ) );
    activeDocument.activeLayer = lastActive;
    return layerColor;

Similar Messages

  • I get an 'error occured' when saving a project after pasting text from Photoshop CC

    I get an 'error occured, restart Edge Animate' when saving a project after pasting text from Photoshop CC. If I manually type the text its fine.

    when I launch Photoshop CC, I get an error message
    and what exactly is the text of that error message?

  • Move to new computer, get "An error occurred while reading files or writing files to disc. The disc

    I tried to move my PE6 install and catalog to a new computer.  It was on a Dell Windows XP machine, and I moved it to a Toshiba Windows 7 (64 bit) machine.  I have always kept my photo files on an external hard drive.  My photo library is 50GB, 10,000 files.  Here is what I did.
    Copied the original PE6 install file to the Toshiba.  Installed but didn’t activate it.
    Copied the entire My Catalog folder to the proper Windows 7 location.
    Plugged the external drive into the Toshiba.  Made sure the same drive letter as before (E).
    Fired up PE6 on Toshiba.  Looked good in Organizer.  Everything seemed to be there, but I didn't try to make changes at that point.
    Deactivated PE6 on the Dell.  Activated on the Toshiba.
    Then I realized that it is not right.  I can edit Keywords and Rating stars on the pics, but not dates, captions or notes.  I get “An error occurred while reading files or writing files to disc. The disc may be full or there may be problems with the source media.”
    Only a fraction of the external drive is in use.
    I can access the files on the external drive with another app (Windows Photo Viewer).
    I tried Reconnect All Missing Files.  Somewhat ambiguously, it says “There are no files to reconnect.”
    In the properties in the Organizer for each picture are the proper file names and paths.  Folder view works fine in Organizer.
    I can put new files in the same external drive directories, import them into PE6, then edit them normally.
    What is the easiest way to get Organizer properly connected to my files?  I suppose I could reimport all the pics on the new machine, but I assume I'd lose some of my metadata.  So that is out of the question.
    Thanks,
    Bill

    Are you sure that file paths are correct? I say this because under XP they would have originally pointed to Documents & Settings/My Pictures whereas on W7 it will be User/Pictures, albeit you are using an external hd.
    Take a look at this knowledge base note on the correct procedure for back-up and restore.
    I think writing metadata to files for such a large catalog will be a thankless task.
    http://helpx.adobe.com/photoshop-elements/kb/backup-restore-move-catalog-photoshop.html

  • Rented movie 3 weeks ago. Trying to watch, I get message: "Error occurred while trying to download this content. Try again later."

    What is wrong? Rented a movie 3 weeks ago. Trying to watch it now, I get message: "Error occurred while loading this content. Try again later."
    Apple TV software is up to date. I can stream music from my computer and also from the Apple music site (whatever it is called). Just get the error on the movie.  Help!
    OS Mavericks 10.9.4 on 2010 MacPro.

    Welcome to the Apple Community.
    Try the following steps, check whether things are working after each step where appropriate, before trying the next.
    Restart the Apple TV (Settings > General > Restart).
    Restart the Apple TV by removing ALL the cables for 30 seconds.
    Restart your router.
    Reset the Apple TV (Settings > General > Reset > Reset all settings)
    Restore the Apple TV (Settings > General > Reset > Restore)

  • Trying to convert a word file to pdf and keep getting "An error occured while signing in"?

    Trying to convert a word file to pdf and keep getting "An error occured while signing in"?

    Or contact Adobe Customer Service via http://helpx.adobe.com/contact.html?product=export-pdf

  • Using Site Content and Structure unable to move documents,pages and getting weird error message

    Hi ,
    earlier we are moving a page ,document from one site to another sub site with in the Site Collection.
    Now,we are getting a un-readable format error.
    After selecting the destination we are getting the error.
    and the file can't move.
    What might me be the error.
    Expecting answers related to my question.
    1.As we can do using Internet Explorer,
    2. Using Send To also we can move.
    Using this Site Content and structure we can maintain Versoining also.
    If any one face the same issue then we can easily find out the solution.
    Regards ,
    Prathap 
    SP Developer
    Specify the destination to move the items you selected.

    Hi,
    Using Site Content and Structure unable to move documents,pages and getting weird error message
    We are getting Below error:
    When Moving Document items from one site to another site in the same site collection using Site content and structure(But it's working in same site,we can move documents from one library to another library)
    1576|/wEWwwECuLLErw0Cy+nFYwK84baBAgK6zNqsAgLs0Le0BQK1s8uaCAL5qrm3CAKk7K6pDwKo9a0GArm+xr4NApKe9KUKAoajpK4CAqqU/2sChJXBtAIC052rYQKS+LTPAgLe+7uQAwLO0re/BwLgoaw2AojAlIMOApSO4JoNAuvW7MoKAojz2P4OAuOMt9EGAv/ns1wC64qI7gEC0LymmAcCro3lnQkCj7viwAsC8Met9QEC3a/DHALg4ZO6AQKAn8ebCALvr72DAwKm/NGmAgKN4aayCQLmmczsCgL+46qSAQKH7paCDgLouOHjDwKGuNCBCQKwuob2CQKP78n3BwLQ7vSYCALxlcvIBALRuajXAwK6/vr4AwKx8YasCQLti5igAQKay7JZAta625IFAuTy6rUKAvnC7eQKApvB3ugPAoTBua8BAoyajvgMAsGdloEJAvH+2KECAua7k9AGAv3Lzd8HAtPD3ocOAuX7hM4GAqO1g9sIAtn65sgFAuDkr9QEAt7I1KkMAryhltsIAtizx/kBAvzS7IcBAr+YhK4PAsO3rtADAvea+sADAsvc4IgKAp/1vIoMApelp3ICl+PqiwwC/KX1gwUC3fv58gIC7ZG/pwIC4cnupQgCq7mdlgYCjciR+AwC8/ue4gkC4YWJywUCs+rviAECpuyJigECkfr5rgkC08rHoQ0C+erayQUCjMqStQkCpIuKtwEC+dG5ngICoZ3/og0CspXoxwwC+pzgmwwCkoD5mAYCn/qH2AcC/N/pvAcCv5OtwAICuZquqgcC0/OFnwkC2/2wzQMCrJrO9woC69G52ggC64nunggCtLOIsQEC9LyC7gUC0ry/zgIC1ZDvgQ0C98OfMgL4kaj3CQKXhebCCwKi3bjPBQKYuojTCAKc4+fxCAKyjLfoBALVxO8SAsXSyuQLAqyvkNIPApDV5PgDAtufwJwEAu2BsoYLAs3Oqd8PAo6i+YMDAsy706oCAsLjx7kLApu3+9gKAuLnvMoIAtWywo8OAv6MjvIHAtSDhJwNArXRmL0LAraZvUcC5cGygQoCz5HN7A0C+YzY9AMCmtWQ6AUC/oHF8w4CxeTgmg8CgszujQECss22vgYCp6HBuggCkfm+FAKngqb5BgKkuIzAAQKPspKCCQLu+eDvCwKf5YrEBQKl0M3ACgKm85DvDALCu/nfCwLbwO38DgLoz5eyDQLfr9XLCwL20/eUDgL7hpr3DAKh1tfbCgL48OuNBwK4tuKaCALpgbn5CgLC4dKvBgKKlu76CwKfhKLJAQLurPTIAwLG0o+hAgKI5Y6dDALq+OOlCQKxjuuICAK8yrLHBwLcrOSSAwLoiJfQCwKKyvrtBALXkbCBCgKt4bG9BQLr6qnxCwLC2pz2DQKQ7OuZBALt7t+DDAKR47b8CAKi6pPGCQKLl4r3CQK5yfj+AwLgzYvjDwKUjerODQK7mOPTCQL9qP3qBgKYiOL9AgLA8pSaBwKay8fBDQLqw93DCgKkjpf/CwLsyquQCwKtpbGsDALMtKmxBwKPpvCmBOAFHtmBuG3iNmIT9fQ8Z1TWMpjZ122|cccccccccnncnnnnn|

  • HT1338 When trying to update my software, I get "an error occurred" message, and the update gets cancelled.  How do I fix it?

    When trying to update my software, I get "an error occurred" message, and the update gets cancelled.  How can I fix this?

    I have found other threads with this problem. The problem is that you are using your iTunes account on another user at the same time you want to update software. Just close iTunes from that user. See > https://discussions.apple.com/thread/4577180?start=0&tstart=0

  • ???  I just installed Lightroom 5 from Amazon for my Mac with 10.10.1 software.  When I open it I get: "An error occurred when attempting to change modules".  It won't import photos and has no side panels under Library.  What should I do?

    I just installed Lightroom 5 from Amazon for my Mac with 10.10.1 software.  When I open it I get: "An error occurred when attempting to change modules".  It won't import photos and has no side panels under Library.  What should I do?

    I Nearly bought from Amazon too but I found a thread from Adobe stating that the only recognized outlet for lightoom is themselves and other outlets serial numbers will not be guaranteed.
    THat at was sufficient for me to buy direct from Adobe, hope you get it sorted.

  • Each time I try to install iOS 7.1.1 on my iPad I get an error occurred message. Can anyone help

    Each time I try to install update iOS 7.1.1 on my iPad I get an " error occurred " message. Can anyone give me advice on how to proceed ?

    The exact wording of Error messages and Alerts are imperative in ascertaining your issue.
    Mrsvgi wrote:
    Each time I try to install update iOS 7.1.1 on my iPad I get an " error occurred " message. Can anyone give me advice on how to proceed ?
    If you are having issues using OTA (over the air) to update...
    Do the Update using iTunes on your Computer.
    See the Using iTunes Section Here...
    How to update your iPhone, iPad, or iPod touch
    Make sure you have the Current Version of iTunes Installed on your computer
    iTunes free download from www.itunes.com/download

  • TS3694 Unable to upgrade ipad version 3.2.2;requires iTunes 10.6.3 but this won't download. Tried to restore but get "unknown error occurred (3194)". Please can anyone advise? Thank-you, Rosemary

    Tried to restore but get "unknown error occurred (3194)". Please can anyone advise?
    Thank-you,
    Rosemary

    Have you got the latest version of iTunes on your computer ? There is some troubleshooting for that error code on this page which you could try.

  • When attempting to convert pdf to word doc, I continually get "An error occurred while signing in" despite the fact that I'm already signed in.  Please help if you can?

    When attempting to convert pdf to word doc, I continually get "An error occurred while signing in" despite the fact that I'm already signed in.  Please help if you can?

    Hi lorrelaws,
    Do you receive that error when you try to sign in via Reader? If so, try signing in via the web interface. Did that do the trick?
    Let us know how it goes.
    Best,
    Sara

  • I just created an apple ID and then tried to log in to facetime but, keep getting : an error occurred during activation, try again" can anyone assist?

    i just created an apple ID and then tried to log in to facetime but, keep getting : an error occurred during activation, try again" can anyone assist?

    i just created an apple ID and then tried to log in to facetime but, keep getting : an error occurred during activation, try again" can anyone assist?

  • I get 'an error occurred when attempting to adjust module"

    I took the mac into the Apple store and they tried updating and following online suggestions. but were not able to make it work - any suggestions
    Everytime I have tried to use Lightroom2  and recently Lightroom 5 I get 'an error occurred when attempting to adjust module"
    Anyone know how to solve this as I really want to get using Lightroom

    http://helpx.adobe.com/lightroom/kb/error-changing-modules-lightroom.html

  • I'm getting "an error occurred loading this content" when trying to airplay youtube from my iPhone 5.  My brother is using his iPhone 4s with no problem.  Is there something wrong with my settings?

    I'm trying to airplay youtube from my iPhone 5 but I'm getting the error message.  I can airplay music, pictures, and other video, but no streaming.  My brother is using my appletv and wi-fi with his iphone 4s with no problems.  Any suggestions?

    I started having this problem a week or so ago, after having used the Apple TV for a couple of months with only some minor problems.  Yesterday, however, I started getting this problem again and today I could not get to Airplay from my Ipad - just kept getting the "error occurred" message on my tv screen.  I tried the various fixes I could find on Google - at least the ones I could understand - but with no luck.  Then I decided to bite the bullet and pay for Apple support, even tho the problem is with the device and not due to my ignorance.  So I talked with a support person who said I would have to pay $19.95 for 30 days of support and was glad to take my credit card information.  This person had never heard of the problem, and ending up bumping me up to an Apple TV specialist, after spending 20 minutes or so on hold, and explaining the problem, etc.  I finally got to the specialist who had heard of this problem and said that she was crediting me for the $19.95, since the problem is due to a KNOWN HARDWARE ERROR.  In fact, she said that Apple would give me a new, replacement unit if I would go to the nearest Apple store.  This even tho I bought the unit used - it is still covered.  Now I have to make a 100 mile round trip to the Apple store, since Apple won't send the new one out in the mail, even if I return mine first.  And Apple won't pay for my gas.  So that's the mostly good and some bad news.  I hope that the new unit won't have this problem, but I think the bigger issue is that since Apple knew about the problem that affects certain serial numbers, why don't they post that information on their support sites or just make it findable by a Google search.  Whenever I have had a problem with Windows, I have always been able to find a Microsoft article or fix addressing it by doing a Google search, but Apple, always desiring to be arcane and opaque, isn't interested in this approach.  In fact, why not just put together a "known problems" site for Apple products so that users can find this kind of information easily, without having to put out $19.95 for technical support that isn't needed, and wasting their own time (and money, as in my case, for gas).  The bottom line is that all of the people with this problem who posted (and there are many) were apparently ignorant that Apple KNEW ABOUT THE PROBLEM AND WILL REPLACE THE BAD UNITS.  This is because, I am sure, they don't want to shell out the $19.95.  Anyway, hope this helps someone.  I doubt if Apple will listen to the suggestion.   Good luck..

  • I am unable to play a rented movie's on my ATV 2. I get: An error occurred loading this content. Try again later.

    I am unable to play a rented movie on my ATV 2. I get: An error occurred loading this content. Try again later. My ISP has the TCP 80 port blocked but the TCP 443 port open. My first gen. Apple TV  is OK.

    Welcome to the Apple Community.
    I doubt port 80 is blocked, that port is used for http, which you might recognise as the basis for the world wide web.
    The message you get can be as a result of an extremely slow Internet connection, you can test your connection speed using speednet.com, however more commonly it's a simple error that can be corrected by unplugging and restarting the Apple TV and/or restarting the router.

  • Im using premiere element 9 getting serious error occurred force to close can't open project crashes

    Im using Mac and recently when openning projects in premiere 9 i get serious error occurred force close. It was working and my computer crashed and new hardware was installed. I was able to do one project before this started. I can edit and complete my video but cant burn or reopen the project without get the error message and closes. How do i repair?

    What was it that Meatload said, "two out of three ain't bad... ?"
    Glad that two Projects burned properly.
    Before you trash that one Project, I would do this little exercise:
    Move all of your Assets (your Media files) to another folder, so that PrE cannot find them. That part is much easier, if you set up your Project in its own folder structure, with sub-folders containing all media used.
    Then Open that Project. In the loading process, you should get a dialog screen, asking "Where is file ______?" At that point, navigate to the new location, that you Moved the files to. PrE will then re-link to that first file, and then survey the PREL (Project) file, and re-link to every file used in the Project. If the media is in several sub-folders, you will need to repeat that navigation to the respective sub-folder.
    Then, test the Project to see if that re-linking has "fixed" things.
    If not, then the Project is probably corrupt.
    Good luck, and let us know how it goes.
    Hunt

Maybe you are looking for