PhotoshopForums.com Home
Navigate Contact FAQ Search Members
applescript RGB to CMYK
Post new topic   Reply to topic    PhotoshopForums.com Forum Index -> Actions and Automation
 See a User Guidelines violation? Please contact us.
Author Message

tpikus

Joined: 02 Nov 2010
Posts: 1



PostPosted: Tue Nov 02, 2010 10:16 pm    Post subject: applescript RGB to CMYK Reply with quote

I've written a script which does among other things converts RGB images to CMYK. When this conversion is done photoshop uses the current settings loaded in Color Settings to set GCR, dot gain, and other settings. So the script checks to make sure that a properly named settings exist. This works, but I would far prefer to applescript the Color Settings and set them directly when doing the Change Mode, or to be able to directly set them without relying on a specific Color Setup existing. This script will be used in a number of locations and I can't rely on the proper Color Setup existing or being properly configured, either option either stopping the script or resulting in an improper conversion.

I've seen references to Change Mode Options, but haven't been able to find anything specific as to what options I can set or what the syntax is. I've found no information as to how to directly set the values for Color Settings Preferences.

Any help would be appreciated.

Mac OSX 10.4.11 Photoshop CS3

Tomasso
View user's profile Send private message

Paul R

Joined: 06 Apr 2010
Posts: 57



PostPosted: Wed Nov 03, 2010 4:07 am    Post subject: Reply with quote

Not everything is doable via the DOM. A lot of the time you need to install the ScriptListener plugin and use the Action Manager code that it produces. As this will be javaScript you would have to use doJavascript in your appleScript.
Here is an example of checking the document mode and setting the color working space.
Code:

setColorSetting();

function setColorSetting() {
if(!documents.length) return;
    var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putProperty( charIDToTypeID('Prpr'), stringIDToTypeID('colorSettings') );
        ref.putEnumerated( charIDToTypeID('capp'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
    desc.putReference( charIDToTypeID('null'), ref );
        var desc2 = new ActionDescriptor();
        switch(activeDocument.mode){
            case DocumentMode.CMYK : desc2.putString( stringIDToTypeID('workingCMYK'), "U.S. Web Coated (SWOP) v2" );break;
            case DocumentMode.RGB : desc2.putString( stringIDToTypeID('workingRGB'), "sRGB IEC61966-2.1" ); break;
            case DocumentMode.GRAYSCALE : desc2.putString( stringIDToTypeID('workingGray'), "Dot Gain 20%" ); break;
            default : return;
        }
    desc.putObject( charIDToTypeID('T   '), stringIDToTypeID('colorSettings'), desc2 );
    executeAction( charIDToTypeID('setd'), desc, DialogModes.NO );
}

If you are till struggling you will find more help on the dedicated Photoshop scripting forums:
www.ps-scripts.com/bb
or the Adobe site
http://forums.adobe.com/community/photoshop/photoshop_scripting
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PhotoshopForums.com Forum Index -> Actions and Automation All times are GMT - 6 Hours
Page 1 of 1
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Contact - User Guidelines >

Copyright © 2003-2016. PhotoshopForums.com, iFroggy Network. All Rights Reserved.
Powered by phpBB © phpBB Group. phpBB SEO. Privacy Policy.
We are in no way affiliated with Adobe. Photoshop, Adobe and related marks are registered trademarks of Adobe.
PhotoshopForums.com