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

Load a layer from the CC Library

Contributor ,
May 17, 2016 May 17, 2016

I currently use a basic script that opens a file from a set location and then copies and pastes it into the document that I am working on. This works fine up until the point I switch to another application and it can't copy and paste the image as photoshop must be active.

Now is it possible to save the file in the CC library and then call it from script?

Or can the image be saved in the script itself?

Many Thanks

Matt

TOPICS
Actions and scripting
426
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
Adobe
Community Expert ,
May 17, 2016 May 17, 2016

Could you elaborate on the process?

Why copy/paste and not place as a Smart Object?

Which other application?

With BridgeTalk it is possible to include operations in Photoshop, Illustrator and Indesign for example in one Script, but otherwise a plain Photoshop jsx is not useful for commanding multiple applications.

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 ,
May 17, 2016 May 17, 2016

ahh, just hit the correct answer box by accident!

I ended up copy and pasting as I did it in applescript which as you know is limited. I couldn't figure out how to use place Smart object.

I copy and paste a textured background layer in before the layer "Main Image".

Also when I meant switching to another application i mean I would activate the script that would open the textured layer and select all copy and then close the file then paste on the original document. If I then happened to switch apps during this process it would hang as it was trying to copy the active app not specifically photoshop.

I hope that makes more sense

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
Community Expert ,
May 17, 2016 May 17, 2016

I do not concern myself with AppleScript for Photoshop Scripting.

Have you tried using ScriptingListener.plugin to record placing a Smart Object?

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 ,
May 18, 2016 May 18, 2016

I've done the listening tool, if you drag the layer it records it, if you right click it and paste layers it records nothing.

Based on that I got this.

Now the only issue is I am trying to scale that image up the longest edge of the active document. the figure at the bottom 3403 is a percentage, how can I change that to pixels?

Matt

var idPlc = charIDToTypeID( "Plc " );

    var desc31145 = new ActionDescriptor();

    var idIdnt = charIDToTypeID( "Idnt" );

    desc31145.putInteger( idIdnt, 23 );

    var idnull = charIDToTypeID( "null" );

    desc31145.putPath( idnull, new File( "/Users/StudioA/Library/Application Support/Adobe/Creative Cloud Libraries/LIBS/3A4A3DF94C08C3810A04B82B_AdobeID/creative_cloud/dcx/8c51c960-5512-11e4-a6c6-4b7bbeb29660/components/fc3bd270-9644-41e7-b2ea-62ad91ea2e45.psd" ) );

    var idLyrN = charIDToTypeID( "LyrN" );

    desc31145.putString( idLyrN, """Layer 1""" );

    var idLnkd = charIDToTypeID( "Lnkd" );

    desc31145.putBoolean( idLnkd, true );

    var iddontRecord = stringIDToTypeID( "dontRecord" );

    desc31145.putBoolean( iddontRecord, true );

    var idforceNotify = stringIDToTypeID( "forceNotify" );

    desc31145.putBoolean( idforceNotify, true );

    var idFTcs = charIDToTypeID( "FTcs" );

    var idQCSt = charIDToTypeID( "QCSt" );

    var idQcsa = charIDToTypeID( "Qcsa" );

    desc31145.putEnumerated( idFTcs, idQCSt, idQcsa );

    var idOfst = charIDToTypeID( "Ofst" );

        var desc31146 = new ActionDescriptor();

        var idHrzn = charIDToTypeID( "Hrzn" );

        var idPxl = charIDToTypeID( "#Pxl" );

        desc31146.putUnitDouble( idHrzn, idPxl, -0.500000 );

        var idVrtc = charIDToTypeID( "Vrtc" );

        var idPxl = charIDToTypeID( "#Pxl" );

        desc31146.putUnitDouble( idVrtc, idPxl, -0.500000 );

    var idOfst = charIDToTypeID( "Ofst" );

    desc31145.putObject( idOfst, idOfst, desc31146 );

    var idWdth = charIDToTypeID( "Wdth" );

    var idPrc = charIDToTypeID( "#Prc" );

    desc31145.putUnitDouble( idWdth, idPrc, 3403.636364 );

    var idHght = charIDToTypeID( "Hght" );

    var idPrc = charIDToTypeID( "#Prc" );

    desc31145.putUnitDouble( idHght, idPrc, 3403.636364 );

executeAction( idPlc, desc31145, 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
Contributor ,
May 18, 2016 May 18, 2016
LATEST

Fingers crossed I have adapted this.

But seams to work so far 4286 is the height of the original document,

(function (){

    var startRulerUnits = app.preferences.rulerUnits; 

    app.preferences.rulerUnits = Units.PIXELS; 

    var bounds = activeDocument.activeLayer.bounds; 

    var height = bounds[3].value - bounds[1].value;

    var newSize = (100 / height) * 4286; 

    activeDocument.activeLayer.resize(newSize, newSize, AnchorPosition.MIDDLECENTER);

    app.preferences.rulerUnits = startRulerUnits; 

})();

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