Giter Club home page Giter Club logo

Comments (11)

jardicc avatar jardicc commented on June 9, 2024 1

I think DOM uses AM and you need to do extra AM interface for anything new feature you do. If you would remove AM and keep scripting posibilities there would be enormous amount of work. And some buil-in feature uses AM including Library panel (flag ship)

I found something called: ExecuteJSONActions in binaries files. But I don't know if this is what we want.
New new document dialog uses json. But it's only for saving presets.

from descriptor-info.

JavierAroche avatar JavierAroche commented on June 9, 2024 1

Btw, @jardicc did you check this one out? :)
parse-action-descriptor-code
Live example: https://javieraroche.github.io/parse-action-descriptor-code/

from descriptor-info.

JavierAroche avatar JavierAroche commented on June 9, 2024

Oh awesome!! I remember talking about this "json" property with Davide Barranca a while ago, but it looked like it wasn't supported across all photoshop versions. I just tested on CC2015.5 and CC2017 and it works!

It's actually pretty cool that we get similar results :) but this repo is probably not needed anymore, unless someone wants compatibility with previous versions where the "json" property might not exist.

from descriptor-info.

jardicc avatar jardicc commented on June 9, 2024

David reported some bugs in current Photoshop version. So it might not be reliable now. It think this repo has use cases. Sometimes you want adjust your output. Compatibility debug is also important.

So I will use your code in future.

This is my debug tool: https://pastebin.com/NczkaAAt

You can pause running script and run in console:
#include c:\path\to\script\MagicInsight.jsx insight.layer()

And it will create file on the desktop file with info about selected layer (if you didn't used parameters which layer you want). Similar for app and document. Simple, usefull and on the fly.

from descriptor-info.

jardicc avatar jardicc commented on June 9, 2024

I am now interested what "jsonAction" stringID means. It's right next to "convertJSONDescriptor" stringID
http://sklad.bereza.cz/00-jarda/00_screenshot/2017-05-30_230558.jpg

I suspect that you could write json instead action manager cryptography

from descriptor-info.

JavierAroche avatar JavierAroche commented on June 9, 2024

Nice! I like your adaptation of this. I think I'll try to fix some of the remaining issues and merge back to master.

It'd be cool if "convertJSONDescriptor" gives us a way to script a descriptor using a JSON object. That was another idea for this project, to use the object that descriptor-info spits out, modify some values, and send it back to Photoshop to implement new values. Or, just to create an object with the correct properties and send it to Photoshop, but it's a very complicated thing to do since all descriptors have different levels of complexity.

Also, who knows how long ExtendScript will stick around. I can see Adobe rewriting Photoshop's DOM in the future. ExtendScript is just not manageable moving forwards.

from descriptor-info.

jardicc avatar jardicc commented on June 9, 2024

Check this: https://github.com/jardicc/ActionManagerHumanizer
string to descriptor; descriptor to string

from descriptor-info.

JavierAroche avatar JavierAroche commented on June 9, 2024

Hey man! I saw it earlier, but I never got a chance to try it out until now. It's super cool, great job man! Hopefully our tools help a lot of people starting in ExtendScript 😃

The object, convertJSONdescriptor and json IDs are fantastic. It took Adobe a long time to implement them! :)

from descriptor-info.

jardicc avatar jardicc commented on June 9, 2024

A lot of people did similar tool.
I did "lexicon" library this allow me write code like this:

var desc1 = new LxActionDescriptor();
var desc2 = new LxActionDescriptor();
desc2.putString( "name", """New File""" );
desc2.putBoolean( "artboard" , false );
desc2.putClass( "Md ", "RGBM" );
desc2.putUnitDouble( "width", "#Rlt", 480.000000 );
desc2.putUnitDouble( "height", "#Rlt", 360.000000 );
desc2.putUnitDouble( "resolution", "#Rsl", 300.000000 );
desc2.putDouble( "pixelScaleFactor", 1.000000 );
desc2.putEnumerated( "fill", "fill", "transparent" );
desc2.putInteger( "Dpth" , 8 );
desc2.putString( "profile" , """sRGB IEC61966-2.1""" );
desc1.putObject( "new" , "document" , desc2 );
desc1.putInteger( "DocI", 208 );
executeAction( "make", desc1);

But I don't have yet automated tool for conversion into "lexicon" format.

from descriptor-info.

JavierAroche avatar JavierAroche commented on June 9, 2024

Yeah the Clean JSX and the Sort IDs are pretty simple functions, but the interesting one is when you select Create Function from the dropdown. You can use that to turn that "make new doc" function, into a flexible function, like this:

function makeNewDoc(params) {
	var desc1 = new ActionDescriptor();
	var desc2 = new ActionDescriptor();
	desc2.putString( charIDToTypeID( "Nm  " ), params.name);
	desc2.putBoolean( stringIDToTypeID( "artboard" ), params.artboard);
	desc2.putClass( charIDToTypeID( "Md  " ), charIDToTypeID( "RGBM" ) );
	desc2.putUnitDouble( charIDToTypeID( "Wdth" ), charIDToTypeID( "#Rlt" ), params.width);
	desc2.putUnitDouble( charIDToTypeID( "Hght" ), charIDToTypeID( "#Rlt" ), params.height);
	desc2.putUnitDouble( charIDToTypeID( "Rslt" ), charIDToTypeID( "#Rsl" ), params.resolution);
	desc2.putDouble( stringIDToTypeID( "pixelScaleFactor" ), params.pixelScaleFactor);
	desc2.putEnumerated( charIDToTypeID( "Fl  " ), charIDToTypeID( "Fl  " ), charIDToTypeID( "Trns" ) );
	desc2.putInteger( charIDToTypeID( "Dpth" ), params.depth);
	desc2.putString( stringIDToTypeID( "profile" ), params.profile);
	desc1.putObject( charIDToTypeID( "Nw  " ), charIDToTypeID( "Dcmn" ), desc2 );
	desc1.putInteger( charIDToTypeID( "DocI" ), params.docID);
	executeAction( charIDToTypeID( "Mk  " ), desc1, DialogModes.NO );
}

var params = {
	name: "New File" ,
	artboard: false ,
	width: 480.000000 ,
	height: 360.000000 ,
	resolution: 300.000000 ,
	pixelScaleFactor: 1.000000 ,
	depth: 8 ,
	profile: "sRGB IEC61966-2.1" ,
	docID: 208 
};

makeNewDoc(params);

from descriptor-info.

jardicc avatar jardicc commented on June 9, 2024

So... I also added some code cleaning into Humanizer :-)

https://github.com/jardicc/ActionManagerHumanizer/blob/master/README.md#how-to-convert-action-manager-script-listener-code-into-playable-humanized-code

On my roadmap is also converting humanized code back into AM vomits :-)
Because it's faster and sometimes it is good for code obfuscation.
So you can convert low-level code into mid-level code, understand what is going on, make some changes and convert it back.

Note to your params object.

What if you have e.g. color gradient with several color stops. How would you know which green is in which color stop?

from descriptor-info.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.