Possibility to save script palette menus and load curves?

Is it possible to Photoshop CS4 script palette menus? Specifically, the "save curves preset...". ' and 'load curves Preset"... the range of settings.

I have 600 photos, some of which have layer > new adjustment layer > curves applied.

I want to save the curves using the name of the image. Later, I want to be able to load the appropriate curve.

For example, for image001.tif, the curve would be image001.acv

(I already have a loop set up to browse files and get the file names.)



I can't help with Applescript (or even know if it is possible to do it with only Applescript). And to my knowledge you can't have things script in dialog boxes like load or save the curve directly. But here's the javascript code which will load and save settings.

First of all the easy part, defining an adjustment of the layer of a file.

function loadCurves( file ) {
    var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putEnumerated( charIDToTypeID( "AdjL" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
    desc.putReference( charIDToTypeID( "null" ), ref );
        var desc1 = new ActionDescriptor();
        desc1.putPath( charIDToTypeID( "Usng" ), new File( file ) );
    desc.putObject( charIDToTypeID( "T   " ), charIDToTypeID( "Crvs" ), desc1 );
    executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
};

The code to write that file .acv an adjustment layer is a bit more involved and does not work with all color modes

// Works with RGB or CMYK images.
// Does not work at all with greyscale, or indexColor
// Does not work correctly with Lab
File.prototype.writeByte = function(b) {
  this.write(String.fromCharCode(b));
};
File.prototype.writeShort = function(ET,s) {
  var self = this;
if(ET == "BE"){
  self.writeByte(s & 0xFF);
  self.writeByte((s >> 8) & 0xFF);
}else{
  self.writeByte((s >> 8) & 0xFF);
  self.writeByte(s & 0xFF);
}
  return self;
};
function convertBCD( num ){
    var res = new Array;
    if(num > 16 ){
        res.unshift(1);
        num = num - 16;
    }else{
        res.unshift(0);
    }
    if(num > 8 ){
        res.unshift(1);
        num = num - 8;
    }else{
        res.unshift(0);
    }
    if(num > 4 ){
        res.unshift(1);
        num = num - 4;
    }else{
        res.unshift(0);
    }
    if(num > 2 ){
        res.unshift(1);
        num = num - 2;
    }else{
        res.unshift(0);
    }
    if(num == 1 ){
        res.unshift(1);
    }else{
        res.unshift(0);
    }
    return res;
};
function getCurve( numberOfPoints ){
    this.getPoints = function(){
        this.tempArray = new Array;
        this.tempArray.push( rawDesc.charCodeAt( pointer ) );
        pointer = pointer + 2;// set pointer to next point
        this.tempArray.push( rawDesc.charCodeAt( pointer ) );
        return this.tempArray;
    }

    this.pointsArray = new Array;
    for( var i = 0; i < numberOfPoints; i++ ){
        pointer = pointer + 2;// next point
        this.pointsArray.push( this.getPoints() );
    }
    pointer = pointer + 2;// next curve
    return this.pointsArray;
};

var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( 'Lyr ' ), charIDToTypeID( 'Ordn' ), charIDToTypeID( 'Trgt' ) );
var rawDesc = executeActionGet( ref ).getList( stringIDToTypeID( 'adjustment' ) ).getObjectValue( 0 ).getData( stringIDToTypeID( 'legacyContentData' ) );

var pointer = 2;// used to read rawData similar to reading a file
var flag = rawDesc.charCodeAt( pointer );// char at offset 2 always == 1 so use to validate data
if( flag != 1 ) forceError;// unknown problem with rawData
    pointer = 6;// update pointer to BCD byte
    var bcd = rawDesc.charCodeAt( pointer );
    if( bcd < 0 || bcd > 31 ) forceError;// check for valid value
    if( bcd == 0 ) forceError;// an empty adjustment - no curves to process
    var bcdArray = convertBCD( bcd );
    var numberOfCurves = bcdArray.toString().match(/(1)/g).length;
    var curvesArray = new Array;
    pointer = 8;// set pointer to start of curve data
    for(var i = 0; i < numberOfCurves; i++ ){
        var numberOfPoints = rawDesc.charCodeAt( pointer );
        curvesArray.push( getCurve( numberOfPoints ) );
    }
// now need to map rawData curves in curvesArray to known channel curves
var acvArray = new Array;
if( bcdArray[0] == 1 ) {
    acvArray.push( curvesArray.shift() );
} else {
    acvArray.push( [ [0,0],[255,255] ] );
}
if( bcdArray[1] == 1 ) {
    acvArray.push( curvesArray.shift() );
} else {
    acvArray.push( [ [0,0],[255,255] ] );
}
if( bcdArray[2] == 1 ) {
    acvArray.push( curvesArray.shift() );
} else {
    acvArray.push( [ [0,0],[255,255] ] );
}
if( bcdArray[3] == 1 ) {
    acvArray.push( curvesArray.shift() );
} else {
    acvArray.push( [ [0,0],[255,255] ] );
}
if( bcdArray[4] == 1 ) {
    acvArray.push( curvesArray.shift() );
} else {
    acvArray.push( [ [0,0],[255,255] ] );
}
var myACV = new File('~/desktop/myCurve.acv');
myACV.open('w');
myACV.writeShort( 'LE','4' );// acv header
myACV.writeShort( 'LE','5' );// acv header
for( var i = 0; i< 5; i++ ) {
    var numberOfPoints = acvArray[i].length;
    myACV.writeShort( 'LE', numberOfPoints.toString() );
    for( var p = 0; p < numberOfPoints; p++ ){
        myACV.writeShort( 'LE', acvArray[i][p][0].toString() );
        myACV.writeShort( 'LE', acvArray[i][p][1].toString() );
    }
}
myACV.close();

I wrote this earlier. It may be possible to simply write the header of acv, then add the raw data from the descriptor to work with other modes of.

Also, neither verifies that the selected layer is a curves adjustment layer and will fail if it is not.

Tags: Photoshop

Similar Questions

  • Save and load curves

    I work with PS CS4 and can't figure out how to record and curves of load, which was in the curves dialog box.  The online Help menu indicates that I need to go to the «...» Option Save preset in the Panel menu. »

    For the life of me, I can't find an option "Save Preset" in the Panel menu.

    I hesitated to post this question, because the answer is bound to be easy stupifying, but I have been struggling with this for a while and just can not understand.

    Any help would be appreciated!

    Select the icon of curves (3rd from the top left side of the Panel settings) and use the Panel (top-right bar) menu to save and load. Your saved curves will also be second in the top of the list. Simply scroll to the top where the direction of the arrow and you will see.

  • Is it possible to save the current tabs and groups so that they can be recharged at any time?

    My Firefox crashes sometimes, and when I start it up again, my groups and tabs that I had are lost, so I need to recreate my history window. Is there a way I can save the groups that I have with the tabs on the inside so that I can retrieve them at a later date.
    "I say that Firefox does not save the whenever I close the browser, so I'm güssing there a file somewhere that contains this information, if I know how is called this file I could save it on my regular schedule and retrieve them if I had to, of course the best solution would be to have a ' save the groups ' & 'Support groups' in the menu.

    Thanks in advance
    DayoJ

    (PIN) App tabs and groups of tabs (Panorama) are stored in session data in the sessionstore.js file in the Firefox profile folder.

    You can use this button to go to the Firefox profile folder currently in use:

  • It is possible add a smaller hard drive and load windows os on it so that the system boots from that?

    I have a new h9-1150 systems.

    Have a hard drive 2 TB as OS main drive seems like a loss, especially if it crashes. This would make a great backup disk, but Windows 7 is already installed on it. Is it possible to transfer Windows to a secondary drive?

    Hello

    There are few software around which allow you to clone your HDD in a new HARD drive. Normally, you have to work the numbers (whereby the software). I have clone from a HDD of 750 GB for one SSD 120 GB for my wife machine, 2 weeks back using a product called O & O Diskimage, I had to reduce the c: less than 120 GB first. Now, my wife machine runs on a 120 GB SSD and serve a second HDD of 750Go.

    I hope this helps.

  • Save and load the string table

    Hello

    is possible except an array of channel with multiple line of text file and load new file to table with the same size of array?

    Because when I use the code in the picture, initialized array is 3 x 3 but after save and load file is table 5 x 3.

    If is an option how to save this table in the file into 3 x 3 table and charge back of file as a 3 x 3 table?

    Thank your for any suggestion,.

    Petr

    Your code is loaded in 5 x 3 is because two of your cells have newline characters (\n). The reading of the worksheet VI use return or line break characters and your delimiter to figure out how to split the string into an array.

    A solution might be to replace all characters from end of line with something else, and then reinsert it after reading of the worksheet.

    It can do what you want, even if it's a bit bulky. It's a little confusing if you don't understand "------" string formatting, but it essntially replaces all '\r' and '\n' with '\\r' and '\\n', including the conversion of the worksheet does not read as an end of line character.

  • Can change script InDesign native Menus and panels?

    I'm using CS5.

    I want to add/remove/edit elements InDesign native menus and panels. Is this possible at all through the script?

    TIA

    mlavie

    The only way to remove menu items or change the native user interface elements is in C++...

    Substances

  • Is it possible to resize the bar of menus and other toolbars to make them smaller vertically?

    With the update for Firefox 4 my bar menus and toolbars are now take up significantly more space than they where before - is it possible to resize them so that they take up less space?

    You can try one of the compact themes.

  • I want to buy a Apple Watch in the Canada and use it and load it in Ireland. Is this possible?

    I want to buy a Apple Watch in the Canada and use it and load it in Ireland. Is this possible?

    Hello

    If you buy a Apple Watch the Canada, it will be completely compatible with your iPhone in Ireland.

    There are no regional differences in the hardware specifications for the watch, which can be configured to use your preferred language and format of the region.

    The included USB adapter pins will be located at the Canada. However, for charging your watch via the food in Ireland, you can use the charge cable provided on the magnetic head with a real 5W Apple (iPhone) or 12W (iPad) USB power adapter. You can also buy an extra Apple USB power adapter for your watch the Apple Store online for the Ireland:

    http://www.Apple.com/IE/shop/product/MD812B/C/Apple-USB-power-adapter?FNODE=83

    Service of the material to the title of the one year limited warranty is also always available in Ireland.

  • is it possible to save the Office XP for multiple monitors and restore after using the laptop in mobile mode?

    Is it possible to save the Office XP for multiple monitors and restore after using the laptop in mobile mode?

    Hi Kenelms,

    You can follow this link & check if it helps.

    HOW to: Set up hardware profiles for laptop computers in Windows XP

    Hope the helps of information.

    Please post back and we do know.

  • is it not possible to load the game and load the battery other than through the xbox?

    Original title: play and charge

    I just buy a play and charge kit, it is said that it should be charged for 8 hours the first time, that I do not like to leave my xbox on 8 hours, I thought I could use one of these USB plugs that allow a device to be charged using a wall outlet, but I don't get all the lights on the controller No red light to show that the load, then is this not possible to load the game and load the battery other than through the xbox?

    Hello

    You can post the question here for assistance: http://forums.xbox.com/xbox_forums/b/xcsblog/default.aspx

  • Update for the application manager has failed. Impossible to reinstall. Cannot use my apps. Get the 43 error message when I try to re - install. Is it possible to fix this problem without a wipe and load?

    Update for the application manager has failed. Impossible to reinstall. Cannot use my apps. Get the 43 error message when I try to re - install. Is it possible to fix this problem without a wipe and load?

    Error 43 https://forums.adobe.com/thread/2070909

  • ActionScript 3 - Save and load for each level

    Can someone help me
    I create each level in different places.
    Stage 1 for level 1,
    Scene 2 to level 2... so now.

    I want when player push the home button on android hardware, it will save level or charge when the player wants to play the next time.

    I'm already searching the Internet and understand that I must use sharedObject to save and load. But I have found no code example appropriate for me to study.

    And now I don't know how to solve this problem.

    Create the SharedObject class and give it an instance in the first frame of the project:

    var mySO:SharedObject = SharedObject.getLocal ("myProjectID");

    var theScore:Number; It's the score of the player.

    if(!mySO.Data.myScore) / / check the shared object data if there is no data in the name myScore the value to 0, because the first round will not be any data in the shared object, we will write the data later.

    {

    theScore = 0;

    }

    on the other

    {

    theScore = mySO.data.myScore;

    }

    if(!mySO.Data.myFrameNumber) / / same thing here, we will check if there are data to the name myFrameNumber, if there is no, don't do anything.

    {

    fake;

    }

    else / / if there is

    {

    Stop (mySO.data.myFrameNumber, mySO.data.mySceneName);

    }

    All code above must be in the first image.

    NAW every time you want to update the data, for example when you go to the next level using:

    mySO.data.myFrameNumber = currentFrame; the current frame has been preserved in the name "myFrameNumber".

    mySO.data.mySceneName = currentScene.name; the current scene has been preserved in the name "mySceneName".

    mySO.data.myScore = theScore; the score was kept in the name "myScore.

    mySO.flush (); the new data has been written in the class of the shared object.

    You can write any value in the same way

    And if you want to delete the data for a use of reason:

    mySO.clear ();

  • Creative cloud - bar menus and palette are the tiny fonts.

    I just downloaded creative cloud on my lenovo Yoga Pro 2.  The size of my bar menus and Palette are the tiny fonts.  However, the MenuBar of Lightroom and palette are in an easy to read normal size fonts.  Can someone tell me how to change just Photoshop?

    Because now the solution seems to use 200% scale setting in Edit > Preferences > experimental features.

    There is also a setting to edit > Preferences > Interface > UI font size that expands some of the fonts, although not the menu bar.

    After changing a setting, you must restart photoshop to see the changes.

    (File > Exit)

  • data and loading the script sale scheme

    Hello
    I'm learning OBIEE on mine. I managed to install oracle XE and OBIEE 10 g. I need a script to create a new db schema and load the dirty tables with sample data to create reports. can someone help me with scripts?

    Yes, I confirmed that only one Enterprise for Oracle Db edition has the SH schema enabled during installation... you can't have the SH schema without this feature which is ONLY on the Enterprise Edition.

    Here is the article: http://www.dba-oracle.com/t_callan_schema_bye_scott.htm

    Please install the full Enterprise edition and select the SEED DB on install. You will have the sh schema

    If it was OK, please mark as correct.

  • Best way to save and load the MovieClips in As3?

    Hello I am trying to understand the best way to record multiple clips when the application closes and load them when the application opens? PLZ!

    Physically, you can't add content in a swf file that you go back and find what you have created still exists.  You need to store information related to these new content in external storage (cookie, database, xml file, etc.) and then use that information to reconstruct this content when you reopen the file.

Maybe you are looking for