Where to find list of class IDs for photoshop jsx / extendscript - photoshop

While learning about Photoshop scripting I found about the Action Manager, the ScriptListener Plug-In and how it can generate code based on your actions. Sergey Kritskiy was kind enough to help me with a proposed solution (How to adjust the colors of a large number of images based on one spesific?) but there are a lot of class IDs -which are used in charIDToTypeID(), that I do not understand (the code needs to be documented since it will go into my thesis). Strangely there is an index of all EventIDs in the photoshop-cc-javascript-ref-2019.pdf available at adobe help center but cannot find anything similar for class IDs. I googled quite a bit but cannot find anything of the sort. Am I doing something wrong?
For instance the following is the code generated for the filter > Stylize > Emboss (example taken from photoshop-cc-scripting-guide-2019.pdf -from adobe help center )
var idEmbs = charIDToTypeID( "Embs" );
var desc24 = new ActionDescriptor();
var idAngl = charIDToTypeID( "Angl" );
desc24.putInteger( idAngl, 135 );
var idHght = charIDToTypeID( "Hght" );
desc24.putInteger( idHght, 3 );
var idAmnt = charIDToTypeID( "Amnt" );
desc24.putInteger( idAmnt, 100 );
executeAction( idEmbs, desc24, DialogModes.NO );
The 'Embs' is an event Id, while 'Angl', 'Hght', 'Amnt' are class Ids. But while those are easy to guess others like 'Lctn, 'Mdpn', 'Opct' or '#Prc' are not (least to a novice like me)

Download the Photoshop SDK. Inside you'll find some documentation in HTML format.
The key Lctn, for example, can be found in the full 'Adobe Photoshop SDK File List', inside PITerminology.h (to be fair, I had to use a File Search utility to locate it):
#define keyLocation 'Lctn'
In turn, where is this used then? There is some minimal guidance where these are used in `Photoshop Actions Guide.pdf'; it seems all of your abbreviations are function arguments.
Lctn, again for example, is used in eventStroke:
Table 4–36: eventStroke Parameters (6)
Key Type Bounds Options
keyWidth ('Wdth') typeInteger flagsSingleParameter
keyLocation ('Lctn') typeStrokeLocation ('StrL') flagsEnumeratedParameter
keyOpacity ('Opct') unitFloat/unitPercent ('#Prc') flagsEnumeratedParameter
keyMode ('Md ') typeBlendMode ('BldM') flagsEnumeratedParameter
keyPreserveTransparency ('PrsT') typeBoolean flagsOptionalEnumeratedParameter
keyUsing ('Usrs') typeClass ('Type') flagsOptionalSingleParameter
Yeah. This really is badly documented.

Related

How do you do pagination in GUN?

How do you do something like gun.get({startkey, endkey}) ?
Previously: https://github.com/amark/gun/issues/479
#qwe123wsx #sebastianmacias apologies for the delay! Originally posted at: https://github.com/amark/gun/issues/479
The wire spec has a protocol for this but it isn't implemented yet. It looks something like this:
gun.on('out', {get: {'#': {'>': 'a', '<': 'b'}}});
However this doesn't work yet. I would recommend instead:
(1) Pagination behavior is very different from one app to another and will be hard for us to create a "one-size-fits-all" solution, so it would be highly helpful if you could implement your own* pagination and make it available as a user-module, then we can learn from your experience (what worked, what didn't) and make the best solution part of core.
(2) Your app will probably work fine without pagination in the meanwhile, while it can be built (it is targeted for after 1.0), and then as your app becomes more popular, it should be fairly easy to add in without much refactor, once you need it and it is available.
... * How to build your own?
Lots of good articles on this, best one I've seen yet is from Neo4j on how to do it in a graph database (which applies to gun as well) https://graphaware.com/neo4j/2014/08/20/graphaware-neo4j-timetree.html .
Another rough idea is you model your data based on pagination or time. So rather than having ALL tweets go into user's tweet table, instead, the user's tweet table is a table of DAYS (or weeks), and then you put the tweet inside the week table. Now when you load the data, you can scan/skip based off of week very easily while it being super bandwidth efficient.
Rough PSEUDO code:
function onTweetSend(tweet){
gun.get('user').get('alice').get('tweets').get(Date.uniqueYear() + Date.uniqueWeek()).set(tweet)
}
function paginateUserTweet(howMany, cb){
var range = convertToArrayOfUniqueWeekNamesFromToday(howMany);
var all = [];
range.forEach(function(week){
gun.get('user').get('alice').get('tweets').get(week).load(function(tweets){
all.push(tweets);
if(all.length < range.length){ return }
all = flattenArray(all);
cb(all);
});
});
}
Now we can use https://gun.eco/docs/RAD#lex
gun.get(...).get({'.': {'>': startkey, '<': endkey}, '%': 50000}).map().once(...)

Service Area Polygon Geometry

I need to get a service area polygon (graphics) for inserting it into a query as geometry.
This is a piece of code (a serviceAreaTask)
serviceAreaTask.solve(params,function(solveResult){
var polygonSymbol = new SimpleFillSymbol("solid",
new SimpleLineSymbol("solid", new Color([232,104,80]), 2),
new Color([232,104,80,0.25])
);
arrayUtils.forEach(solveResult.serviceAreaPolygons,function(serviceArea){
serviceArea.setSymbol(polygonSymbol);
map.graphics.add(serviceArea);
});
According to API ServiceAreaSolveResult https://developers.arcgis.com/javascript/3/jsapi/serviceareasolveresult-amd.html
ServiceAreaPolygon is already a graphic, and I can use its geometry in my query, but I don´t know how I can get this geometry.
Thanks a lot!
you are correct! As mentined in document serviceAreaPolygons are already in esri graphic format.
Well, geometry is a property of the graphic. below is the way to access this.
In your case-
arrayUtils.forEach(solveResult.serviceAreaPolygons,function(serviceArea){
serviceArea.setSymbol(polygonSymbol);
var serviceAreaGeometry = serviceArea.geometry; // this is the geometry. you can use this geometry in your further query.
map.graphics.add(serviceArea);
});
Hoping this will help you.
Feel free to shoot your further queries.

read all document by using particular category name using alfresco search.luceneSearch or search.lib.js

Category Name
|
Geograpy (8)
Study Db (18)
i am implement my own advance search in alfresco. i need to read all files which related with particular category.
example:
if there is 20 file under geograpy, lucene query should read particular document under search key word "banana".
Further explanation -
I am using search.lib.js to search. I would like to analyze the result to find out to which category the documents belong to. For example I would like to know how many documents belong to the category under Languages and the subcategories. I experimented with the Classification API but I don't get the result I want. Any Idea how to go through the result to get the category name of each document?
is there any simple method like node.properties["cm:creator"]?
thanks
janaka
I think you should specify more your question:
Are you using cm:content or a customized content?
Are you going to search the keyword inside the content of the file? or are you going to search the keyword in a specific metadata(s)?
Do you want to create a webscript (java or javascript)?
One thing to take in consideration:
if you use +PATH:"cm:generalclassifiable/...." for the categorization in your lucene queries, the performance will be slow (following my experince)
You can use for example the next query to find all nodes at any depth below /cm:Languages:
var results = search.luceneSearch("+PATH:\"cm:generalclassifiable/cm:Languages//*\");
Take a look to this url: https://wiki.alfresco.com/wiki/Search#Path_Queries
Once you have all the elements, you can loop all, and get to which category below. Of course you need to create some counter per each category/subcategory:
for(i = 0; i < results.length; i++){
var node = results[i];
var categoryNodeRef = node.properties["cm:categories"];
var categoryDesc = categoryNodeRef.properties["cm:description"];
var categoryName = categoryNodeRef.properties["cm:name"];
}
This is not exactly the solution, but can be a useful idea to start.
Sorry if it's not what you're asking for, I have just arrived from my holidays.

can there be a tooltip with data from the database

I need to know can there be a tooltip populated with data from database to be displayed in the tooltip.
something like the tooltip should contain
name stauts
abc active
xyz active
pqr active
name and status are retrived from db
I need this tooltip onmouseover, am using CJSON decoded to render the content
i did go google but hardly did find that i would throughly understand and implement.
can anyone out there has any ideas for what am looking.
There is a extension named yii-bootstrap, which described clearly here.
For using tooltip easily in this extension, just look here.
I use cluetip for this. Its not related to Yii but will give you some idea :
JS
function renderInfoTips(opts){
var elements=$('#'+opts.form).get(0).elements;
for(i=0; i<opts.tips.length;i++){
$(elements[opts.tips[i].field]).parent().prepend(opts.tips[i].tip);
}
var clue_opts={arrows:true,splitTitle: '|',closePosition: 'title',sticky:true,dropShadow:false,mouseOutClose:true,
onShow:function(ct, ci){
if(!$.browser.webkit) $(ct).css('top',$(ct).position().top- 30+'px');
}
}
$('#'+opts.form).find(".infotip").cluetip(clue_opts);
}
PHP
function setInfoTipsJavascript($form_id,infotips){
if (count($this->infotips) <1 ) return '';
//get all tip names
$names_csv=join(',',array_keys(infotips));
//get tips details from db
$query="select name, description from infotips where FIND_IN_SET(name ,'$names_csv')";
//run the query, in Yii you have to use InfoTipsModel , I have skipped that portion
//$infotipS , lets say this is query object
$tips=array();
while($tip=$infotipS->Assoc()){
$this->infotips[$tip['name']]['tip']="<a href='javascript:void(0)' class='infotip' title='|{$tip['description']}'> </a>";
$tips[]=$this->infotips[$tip['name']];
}
$tips=json_encode($tips);
$script="\nrenderInfoTips({\"form\":'{$form_id}', \"tips\":{$tips}});\n\n";
echo $script;
}
I am sharing this hoping this will give u some idea. Its obvious you have to : create infotips table, a model for that, and create a widget etc to fetch infotips related to your form fields . As someone suggested, if you are using Bootstrap, you have better way to do that.

D3 Graph Example Using In Memory Object

This seems like it should be simple, but I have spent literally hours without any success.
Take the D3 graph example at http://bl.ocks.org/mbostock/950642. The example uses a local file called graph.json. I have set up a Rails app to serve a similar graph, however I don't want to write a file of the JSON. Rather, I generate the nodes and links into an object such as:
{"nodes":[{"node_type":"Person","name":"Damien","id":"damien_person"}, {"node_type":"Person","name":"Grant","id":"grant_person"}}],
"links":[{"source":"damien_person","target":"grant_person","label":"Friends"}}
Now when I render the D3, I need to update the call d3.json("graph.json", function(json) {...}); to reference my in-memory object rather than the local file (or url). However, everything I've tried breaks my html/javascript. For example I tried setting the var dataset = <%= raw(#myInMemoryObject) %>;, and that works for assignment (I did an alert on the dataset), however I can't get the D3 code to use it.
How can I replace the d3.json call in order to use my in-memory object?
Thank you,
Damien
Your idea of using, for example, var dataset = <%= raw(#myInMemoryObject) %>; is the right way to go but you need to prep your object to be in the right format.
The nodes specified in the links need to either be numeric references to nodes in the nodes array eg. 0 for first, 1 for second
var json ={
"nodes":[{"name":"Damien","id":"a"}, {"name":"Bob","id":"b"}],
"links":[{"source":0, "target":1,"value":1}]
}
or links to the actual objects which make the nodes themselves:
var a = {"name":"Damien","id":"a"};
var b = {"name":"Bob","id":"b"}
var json ={
"nodes":[a,b],
"links":[{"source":a,"target":b,"value":1}]
};
Relevant discussion is here: https://groups.google.com/forum/?fromgroups=#!topic/d3-js/LWuhBeEipz4
Example here: http://jsfiddle.net/5A9eV/1/