Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Applescript, create an adjustment Layer with levels

Contributor ,
Feb 26, 2013 Feb 26, 2013

     I can't seam to work out how to do this I want to create a new adjustment layer with levels?

How can I do this

I think I am off the mark but this is all I have

make new art layer with properties {kind:levels layer}

TOPICS
Actions and scripting
1.7K
Translate
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

correct answers 1 Correct answer

Guru , Feb 26, 2013 Feb 26, 2013

If thats your output the do find & replace in your text editor… find all double quotes and replace with single… JavaScript will have either as long as there proper pairs… Then wrap the whole chunk in double quotes for an AppleScript string… pass the string as argument to the app do javascript comamnd…

Translate
Adobe
Guru ,
Feb 26, 2013 Feb 26, 2013

It's been a little while since I scripted PS with AppleScript ( stopped around CS2 )… but if I recall correctly layer kind write access for normal & text all the others are read only… You will probably need to do JavaScript and use ActionManager syntax to create this layer…

Translate
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 ,
Feb 26, 2013 Feb 26, 2013

Screen shot 2013-02-26 at 14.19.19.png

This is how it looks in my actions. Was hoping to avoid Javascript for something "I think" i understand

Translate
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
Guru ,
Feb 26, 2013 Feb 26, 2013

If you have a saved action that is loaded then you can just call that…

Translate
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 ,
Feb 26, 2013 Feb 26, 2013

I was doing that I was hoping to have it as an applescript, just so I can have it all in the same place when installing it on multiple computers.

Do you know how I might be able to create that by calling javascript to create the layer?

Translate
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
Guru ,
Feb 26, 2013 Feb 26, 2013

Im at work where I only have CS5 and non of my old AppleScript snippets… but in answer yes it is possible… Using the scriptlistener plug-in you can record the making of a layer and save as a string inside your AppleScript… I used to a bit of this stuff before moving to Adobe's ExtendScript…

Translate
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 ,
Feb 26, 2013 Feb 26, 2013

might have posted in the wrong section, I have CS5 i'll do the logging thing though!

Thanks

Matt

Translate
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 ,
Feb 26, 2013 Feb 26, 2013

this was the output of the listener

// =======================================================

var idslct = charIDToTypeID( "slct" );

    var desc715 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref17 = new ActionReference();

        var idHstS = charIDToTypeID( "HstS" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idPrvs = charIDToTypeID( "Prvs" );

        ref17.putEnumerated( idHstS, idOrdn, idPrvs );

    desc715.putReference( idnull, ref17 );

executeAction( idslct, desc715, DialogModes.NO );

// =======================================================

var idslct = charIDToTypeID( "slct" );

    var desc716 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref18 = new ActionReference();

        var idHstS = charIDToTypeID( "HstS" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idPrvs = charIDToTypeID( "Prvs" );

        ref18.putEnumerated( idHstS, idOrdn, idPrvs );

    desc716.putReference( idnull, ref18 );

executeAction( idslct, desc716, DialogModes.NO );

// =======================================================

var idslct = charIDToTypeID( "slct" );

    var desc717 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref19 = new ActionReference();

        var idHstS = charIDToTypeID( "HstS" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idPrvs = charIDToTypeID( "Prvs" );

        ref19.putEnumerated( idHstS, idOrdn, idPrvs );

    desc717.putReference( idnull, ref19 );

executeAction( idslct, desc717, DialogModes.NO );

// =======================================================

var idslct = charIDToTypeID( "slct" );

    var desc718 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref20 = new ActionReference();

        var idHstS = charIDToTypeID( "HstS" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idPrvs = charIDToTypeID( "Prvs" );

        ref20.putEnumerated( idHstS, idOrdn, idPrvs );

    desc718.putReference( idnull, ref20 );

executeAction( idslct, desc718, DialogModes.NO );

// =======================================================

var idslct = charIDToTypeID( "slct" );

    var desc719 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref21 = new ActionReference();

        var idHstS = charIDToTypeID( "HstS" );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idPrvs = charIDToTypeID( "Prvs" );

        ref21.putEnumerated( idHstS, idOrdn, idPrvs );

    desc719.putReference( idnull, ref21 );

executeAction( idslct, desc719, DialogModes.NO );

Translate
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
Guru ,
Feb 26, 2013 Feb 26, 2013

That looks like something to do with history to me…

Translate
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 ,
Feb 26, 2013 Feb 26, 2013

Hopefully this is it

var idslct = charIDToTypeID( "slct" );

    var desc2843 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref146 = new ActionReference();

        var idLyr = charIDToTypeID( "Lyr " );

        ref146.putName( idLyr, "Levels 1" );

    desc2843.putReference( idnull, ref146 );

    var idselectionModifier = stringIDToTypeID( "selectionModifier" );

    var idselectionModifierType = stringIDToTypeID( "selectionModifierType" );

    var idaddToSelection = stringIDToTypeID( "addToSelection" );

    desc2843.putEnumerated( idselectionModifier, idselectionModifierType, idaddToSelection );

    var idMkVs = charIDToTypeID( "MkVs" );

    desc2843.putBoolean( idMkVs, false );

executeAction( idslct, desc2843, DialogModes.NO );

// =======================================================

var idDlt = charIDToTypeID( "Dlt " );

    var desc2844 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref147 = new ActionReference();

        var idLyr = charIDToTypeID( "Lyr " );

        var idOrdn = charIDToTypeID( "Ordn" );

        var idTrgt = charIDToTypeID( "Trgt" );

        ref147.putEnumerated( idLyr, idOrdn, idTrgt );

    desc2844.putReference( idnull, ref147 );

executeAction( idDlt, desc2844, DialogModes.NO );

// =======================================================

var idMk = charIDToTypeID( "Mk  " );

    var desc2845 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref148 = new ActionReference();

        var idAdjL = charIDToTypeID( "AdjL" );

        ref148.putClass( idAdjL );

    desc2845.putReference( idnull, ref148 );

    var idUsng = charIDToTypeID( "Usng" );

        var desc2846 = new ActionDescriptor();

        var idType = charIDToTypeID( "Type" );

            var desc2847 = new ActionDescriptor();

            var idpresetKind = stringIDToTypeID( "presetKind" );

            var idpresetKindType = stringIDToTypeID( "presetKindType" );

            var idpresetKindDefault = stringIDToTypeID( "presetKindDefault" );

            desc2847.putEnumerated( idpresetKind, idpresetKindType, idpresetKindDefault );

        var idLvls = charIDToTypeID( "Lvls" );

        desc2846.putObject( idType, idLvls, desc2847 );

    var idAdjL = charIDToTypeID( "AdjL" );

    desc2845.putObject( idUsng, idAdjL, desc2846 );

executeAction( idMk, desc2845, DialogModes.NO );

It should be as simple as selecting the levels adjustment layer then selecting auto.

Matt

Translate
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
Guru ,
Feb 26, 2013 Feb 26, 2013

If thats your output the do find & replace in your text editor… find all double quotes and replace with single… JavaScript will have either as long as there proper pairs… Then wrap the whole chunk in double quotes for an AppleScript string… pass the string as argument to the app do javascript comamnd…

Translate
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 ,
Feb 26, 2013 Feb 26, 2013
LATEST

Oh.. thanks for explaining that one, I knew about listening but never knew what to do with it.

I think I'm getting there,

Translate
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