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

Set thumbnails size inside Layer Panel

Participant ,
Aug 18, 2018 Aug 18, 2018

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
4.1K
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

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

...
Translate
Adobe
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 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
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
Participant ,
Aug 18, 2018 Aug 18, 2018

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

Thanks JJMack for your useful answer.

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

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.

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

Which version of Photoshop?

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

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

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

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

CS6 you can only

runMenuItem(stringIDToTypeID("layersPaletteOptions"))

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

also usefull

runMenuItem(stringIDToTypeID("adjustmentAddMask"))

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

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

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

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.

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

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? 😕

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

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

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

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

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

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

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

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

I see what it does now - un/check menu item in Adjustement panel. I wrongly thought it adds/remove mask to/from 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
Participant ,
Aug 21, 2018 Aug 21, 2018

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

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

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

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

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.

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

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;

    }

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

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

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

All this nonsense crazy))

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

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.

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

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

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

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.

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

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

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