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...
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
...Copy link to clipboard
Copied
This code sets "add copy to layer names"
function setAddCopyToLayerNames (add){
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "addCopyToLayerNames" ) );
ref.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putBoolean(stringIDToTypeID( "addCopyToLayerNames" ), add)
executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
}
setAddCopyToLayerNames (true);
So code for layerThumbnails according code which can read value should look like this:
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "layerThumbnailSize" ) );
ref.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putEnumerated(stringIDToTypeID( "layerThumbnailSize" ), stringIDToTypeID( "size" ),stringIDToTypeID( "none" ));
executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
Anyway it doesn't work and it doesn't throw error either. Any Idea why?
Copy link to clipboard
Copied
I did the same few hours ago basing on a code 'addCopyToLayerNames' you shared with me few months ago. I was sure if that can be read it can be also set, but like in your case to my surprise or because of no abilities it failed, so I even did not post my result. Maybe that was wrong as it's possible and someone will show how to do it correctly...
btw we can check the type, that is enumeration in case of 'layerThumbnailSize', so it uses 3 inputs like you did, but we can't read by Action Manager what exact 3 of them beside first one should be used. Is that your guess they should be 'size' and for ex. 'none' hower they seem to be logical. Maybe there is problem with these names. And once again is there way to check which one should be used or we can only compare some with other SL similar functions they are used in them?
Copy link to clipboard
Copied
https://forums.adobe.com/people/Jarda+Bereza
So code for layerThumbnails according code which can read value should look like this:
var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "layerThumbnailSize" ) ); ref.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) ); desc.putReference( charIDToTypeID( "null" ), ref ); desc.putEnumerated(stringIDToTypeID( "layerThumbnailSize" ), stringIDToTypeID( "size" ),stringIDToTypeID( "none" )); executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
Anyway it doesn't work and it doesn't throw error either. Any Idea why?
I think this is another bug.
Similar code does not work either. Rather, it always resets the color to Default.
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ), stringIDToTypeID( "highlightColorOption" ) );
ref.putEnumerated( charIDToTypeID( "capp" ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putEnumerated(stringIDToTypeID( "highlightColorOption" ), stringIDToTypeID( "highlightColorOptionEnumType" ),stringIDToTypeID( "uiBlueHighlightColor" ));
executeAction( charIDToTypeID( "setd" ), desc, DialogModes.NO );
But this code works.
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("interfacePrefs"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putEnumerated(stringIDToTypeID("highlightColorOption"), stringIDToTypeID("highlightColorOptionEnumType"), stringIDToTypeID("uiBlueHighlightColor"));
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("interfacePrefs"), d1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
Unfortunately for layerThumbnailSize has not yet come up with suitable Preferences
Copy link to clipboard
Copied
"to" key is used to define which property/object on object it is. It is also used for set text descriptor and shape descriptor and layers properties like opacity, fill, ...
Copy link to clipboard
Copied
This is how looks photoshop preferences file when it is converted from binary to JSON.
Anyway only addCopyToLayerNames works for me if I ask for property in application class.
And layer thumbnail size could be "PctS" which is not working under this key.
Copy link to clipboard
Copied
Which exact file (if some) binaries you change to JSON, perhaps one of those in AppData (Windows) folder where files are beeing overwritten while quitting Photoshop? If you didn't notice there's other post of me before yours you can anser for
Copy link to clipboard
Copied
This file:
"C:\Users\Jarda\AppData\Roaming\Adobe\Adobe Photoshop CC 2018\Adobe Photoshop CC 2018 Settings\Adobe Photoshop CC 2018 Prefs.psp"
The answer for message above:
- we can set "copy names" with "set descriptor" action
- this means that you can read descriptor, change it, put it back (set it) and that's all
- but employees in Adobe must explicitly code support for set descriptor
- so this value is Enum and if you want to use "set descriptor" action you should put Enum back
- Enum has these keys: 1) property name (what it is in parent object) 2) what type of enum it is (e.g. predefined colors, predefined sizes,...) 3) one from these predefined values
- you can set thumbnails sizes manually and then read their values and they are: "none", "small", "medium", "large"
Copy link to clipboard
Copied
Precise answer in fact. I know these all though. I asked of something else. If someone wanted to know which type should be used like colors of sizes without checking them in Photoshop I guess there is no way to check it by Action Manager? We can only see how they are used by other for ex. Script Listener outputs or trying to fit those we see in Photoshop?
Copy link to clipboard
Copied
If you are coding C++ things for Photoshop you can also code script support and from this source code you can create AM code. But we don't have a source code. So only possibility is to write and compile custom plugin with script support... read plugin binary and learn how script support looks in binary file and then search same pattern in Photoshop binaries. Which could violate the term of use. And this is not easy...
I was able to read some enum lists in PS binaries but this is something else... it is used for human readable names in Actions panel and they could be also present in the localization file. Thumbnail sizes are not here because it is not recordable action therefore it doesn't need human readable description in action panel.
Interesting fact... for Sketch somebody was able to get header files: Sketch-Headers/Headers at 267983e1ba8fa561c194339773ba8f21ecbd1f73 · abynim/Sketch-Headers · GitHub
https://blog.magicsketch.io/undocumented-sketch-plugin-api-reference-642775b6476d
And according to these headers I was able to use undocumented commands with success. I tried something similar with Photoshop, but from my point of view, I have got only headers for Photoshop UI, not for Photoshop class structure. Nothing useful, but maybe I didn't look properly.
Copy link to clipboard
Copied
Sketch isn't Adobe product so probably you used some method common for multiple applications with C++ to get headers? Are Ps headers an User Interference names of panels or something else, and maybe some other windows like Levels palette from Adjustements menu, or what do you mean by them? With Autohotkey I was able to ger some info about windows and panels, but they are system (Windows) information, are you talking of same data?