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

Set thumbnails size inside Layer Panel

Explorer ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

I wish we could directly set the Thumbnail inside Layer Panel with the help of a script.

Sadly the listener doesn't record the setting of the Thumbnail Size, it only records the call of the Layer panel options .

I already found the helpful code below inside this post : get/set "Add Mask By Default" via AM?

but when i run the code, ESTK responds with the error "this functionnality may not be available in this versin of PS"

var ref = new ActionReference();

ref.putProperty (stringIDToTypeID ("property"), stringIDToTypeID ("layerThumbnailSize"));

ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

var desc = executeActionGet(ref);

var layerThumbnailSize = typeIDToStringID(desc.getEnumerationValue(stringIDToTypeID("layerThumbnailSize")));

alert(layerThumbnailSize);

So, any help is welcome...

TOPICS
Actions and scripting

Views

2.5K

Translate

Translate

Report

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

Community Expert , Aug 18, 2018 Aug 18, 2018

The scriptlistners does record what  I call junk code for some things you do in Photoshop that just does not work in scripts.   There is a script in the forum that can clean scriptlistener code (Clean SL)script  to make it  easer to read and use.  I ask the author to add a remove junk code button to remove statement  I consider junk.  He did and made is easy foe me to add additional statments type to be removed.

Here I set the layers panel  thumbnails size. Scriptlistner recorded 3 Action manage

...

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

The scriptlistners does record what  I call junk code for some things you do in Photoshop that just does not work in scripts.   There is a script in the forum that can clean scriptlistener code (Clean SL)script  to make it  easer to read and use.  I ask the author to add a remove junk code button to remove statement  I consider junk.  He did and made is easy foe me to add additional statments type to be removed.

Here I set the layers panel  thumbnails size. Scriptlistner recorded 3 Action manager steps. From that none are useable.

Clean that code it easy to see its for the layers panel

However if you first remove what I consider junk code you come up empty.

Capture.jpg

JJMack

Votes

Translate

Translate

Report

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
Explorer ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

If I understand you well, there is nothing more to add ...

Thanks JJMack for your useful answer.

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

r-bin​ answers correctly to your qeuestion. However I don't know is setting size of Thumbnail also possible beside reading it in later releases, like some settings I found ScriptListener doesn't write they were set but can be set by using ActionManager.

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

Which version of Photoshop?

You need CC2018 (everything works there) or at least 2015.5 (not sure).

Votes

Translate

Translate

Report

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
Explorer ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

CS6 version ... so it seems like my wish will not become reality !

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

CS6 you can only

runMenuItem(stringIDToTypeID("layersPaletteOptions"))

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

also usefull

runMenuItem(stringIDToTypeID("adjustmentAddMask"))

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

What preconditions in Photoshop need to be met that code with 'adjustmentAddMask' worked?

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

What are you interested in?
Create any adjustment layer. If it is created without a mask, and you need a mask, run this menu. The same applies when the layer is created with a mask and you need it without.

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

It doesn't work for me in CC2018 after adding Adjustement layer of any kind, like Levels or Color Balance for example with/out mask. It doesn't add/remove mask to/from Adjustement Layer when it's selected. What I'm doing wrong? 😕

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

set_add_mask(false)

///////////////////////////////////////////////////////////////////////////////

function set_add_mask(state)

    {

    try {

        var d = new ActionDescriptor();

        var r = new ActionReference();

        r.putClass(stringIDToTypeID("adjustmentLayer"));

        d.putReference(stringIDToTypeID("null"), r);

        var d1 = new ActionDescriptor();

        var d2 = new ActionDescriptor();

        d1.putObject(stringIDToTypeID("type"), stringIDToTypeID("levels"), d2);

        d.putObject(stringIDToTypeID("using"), stringIDToTypeID("adjustmentLayer"), d1);

        executeAction(stringIDToTypeID("make"), d, DialogModes.NO);

        var r = new ActionReference();

        r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("hasUserMask"));

        r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));

        if (executeActionGet(r).getBoolean(stringIDToTypeID("hasUserMask")) == state)

            {

            activeDocument.activeLayer.remove();

            return;

            }

        activeDocument.activeLayer.remove();

        runMenuItem(stringIDToTypeID("adjustmentAddMask"));       

        }

    catch (e) { throw(e); }

    }

upd.

In CC2018 there is a way easier

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

It creates layer and adds a mask to it, then remove them. Still 'adjustmentAddMask' doesn't do anything at end of code 😕

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

Read the post on the link at the beginning of the topic

get/set "Add Mask By Default" via AM?

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

I see what it does now - un/check menu item in Adjustement panel. I wrongly thought it adds/remove mask to/from layer.

Votes

Translate

Translate

Report

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
Explorer ,
Aug 21, 2018 Aug 21, 2018

Copy link to clipboard

Copied

Well, finally, send keys will be my way to go, which of course is not the most beautiful one.

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 21, 2018 Aug 21, 2018

Copy link to clipboard

Copied

Can you share a code how you're going to send keys?

Votes

Translate

Translate

Report

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
Explorer ,
Aug 21, 2018 Aug 21, 2018

Copy link to clipboard

Copied

With a VBS file:

set WshShell = WScript.CreateObject ("WScript.Shell")

WScript.Sleep 300

WshShell.SendKeys "{DOWN}"

WScript.Sleep 10

WshShell.SendKeys "{ENTER}"

WScript.Quit

Then just execute the VBS file via a jsx file.

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 21, 2018 Aug 21, 2018

Copy link to clipboard

Copied

Works in cs6 and cc2018 on win7.
Sometimes it works unstably.

set_layers_thumbs(0) // 0-none,1-sm,2-med,3-large

alert("Done!")

////////////////////////////////////////////////////////////////////////////////////////////

function set_layers_thumbs(size)

    {

    while (ScriptUI.environment.keyboardState.keyName ||

        ScriptUI.environment.keyboardState.ctrlKey ||

        ScriptUI.environment.keyboardState.altKey  ||

        ScriptUI.environment.keyboardState.shiftKey)

    { refresh(); }

    var s = "var WshShell = WScript.CreateObject('WScript.Shell');for(var i=0;i<1000;i++)if(WshShell.AppActivate('Layers Panel Options')){WshShell.SendKeys('{DOWN}');"

    if (size >= 1) s += "WshShell.SendKeys('{DOWN}');";

    if (size >= 2) s += "WshShell.SendKeys('{DOWN}');";

    if (size >= 3) s += "WshShell.SendKeys('{DOWN}');";

    s += "WshShell.SendKeys (' ');WshShell.SendKeys('{TAB}{TAB}{TAB}{TAB}{TAB}');WshShell.SendKeys (' ');break;}else WScript.Sleep(50);WshShell=null;";

    var f = new File(Folder.temp.fsName + "/" + "tmp.js");

    f.open("w");

    f.write(s);

    f.close("w");

    f.execute();

    runMenuItem(stringIDToTypeID("layersPaletteOptions"))

    f.remove();

    f = null;

    }

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 21, 2018 Aug 21, 2018

Copy link to clipboard

Copied

You can use also '{SPACE}{ENTER}' instead of '{TAB}{TAB}{TAB}{TAB}{TAB} '​ in CS 2018, while in CS6 just '{ENTER}'.

Votes

Translate

Translate

Report

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
People's Champ ,
Aug 21, 2018 Aug 21, 2018

Copy link to clipboard

Copied

LATEST

All this nonsense crazy))

Votes

Translate

Translate

Report

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
Explorer ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

In fact the SListener doesn't records nothing when I change the thumbnail size, so I guess I have had the code to open the Layer Panel options from elsewhere, probably from the configurator.

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

Have you ever tried code I wrote for you, you never replied anything for that: Re: How to get an annotation's position ?

Votes

Translate

Translate

Report

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
Explorer ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

In answer to

Kukurykus  a écrit

Have you ever tried code I wrote for you, you never replied anything for that: Re: How to get an annotation's position ? 

Sorry for the late reply...Now it's done. I just have to learn how to use properly the forum.

Thanks again to all for sharing your knowledges.

Votes

Translate

Translate

Report

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
LEGEND ,
Aug 18, 2018 Aug 18, 2018

Copy link to clipboard

Copied

How it answers to Evergreen question if he already found it himself, SL doesn't record that operation that could be used?

Votes

Translate

Translate

Report

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