sttk3
Community Expert
sttk3
Community Expert
Activity
Mar 11, 2025
PNG and JPEG options by `export` cannot specify resolution.
If you want to do so, use `exportforscreens` for AppleScript or `exportForScreens` for ExtendScript.
... View more
Mar 09, 2025
05:26 PM
2 Upvotes
Applying to a non-existent dataset will return [{}] in the result.
If you know the name of the dataset, you can determine whether it succeeded or was ignored by trying to apply it. In other words, it is possible to know indirectly whether the dataset exists or not.
If it succeeds, the result will look like this.
[
{
"_obj": "apply",
"_target": [
{
"_ref": "dataSetClass",
"_name": "set 1"
}
]
}
]
... View more
Mar 09, 2025
05:10 PM
1 Upvote
Tried UXP, can apply but not get a Deta Set. And it needs to specify the name exactly when applying, not the index.
const { app, core, action } = require('photoshop') ;
try {
await core.executeAsModal(async () =>
{
const dataSetName = 'set 1' ;
const result = await action.batchPlay(
[
{
_obj: 'apply',
_target: [
{
_name: dataSetName,
_ref: 'dataSetClass'
}
]
}
],
{}
) ;
app.showAlert(JSON.stringify(result)) ;
},
{
commandName: 'Apply Dataset'
}
) ;
} catch(e) {
app.showAlert(e) ;
}
This is similar to the structure of Workspace, which can select but not get.
Script to Get the Active Workspace Name
... View more
Mar 09, 2025
06:49 AM
I have answered on this page.
How to call a .jsx file from a .psjs file? | Adobe Creative Cloud Developer Forums
... View more
Mar 09, 2025
05:51 AM
UXP Script (psjs) can import external files in CommonJS format.
// main.psjs
const { alert } = require('./external.js') ;
alert('hello') ; // external.js
const { app } = require('photoshop') ;
const alert = async (message) => {
await app.showAlert(message) ;
} ;
module.exports = {
alert
} ;
In UXP Plugin, you can develop a plugin without panel by specifying command in the entrypoints of manifest.json and not specifying panel.
... View more
Mar 05, 2025
07:26 PM
1 Upvote
In the source code, English words are used as they are in English. This is because most programming languages are developed based on English.
If I were writing a programming language like なでしこ, which is based on Japanese, I would probably use Japanese words as they are.
... View more
Mar 05, 2025
06:28 PM
2 Upvotes
Yes, it is the right thinking. Since we will frequently refer to English resources in the context of software, it is easier to cross-convert the meaning of words if we use katakana for the sounds.
If we were to use a Japanese word, it would be difficult to understand the meaning unless kanji is used for the parts of the word where kanji can be used, such as “白”.
Expressions like “shiro” are called “roma-ji” notation. Some people, especially old people, use this notation for variable names, etc., but it is generally regarded as a bad practice.
In addition, concepts used mainly in Japanese are defined in “roma-ji”. For example, “mojikumi” and “kinsoku” in Illustrator fall into this category.
... View more
Feb 28, 2025
05:06 PM
Basically, Stefan-san is right. It is better to do it that way.
If there is only one target layer, you can get it with Document.activeLayer. But if there are multiple, it is possible but you have to perform a miracle.
... View more
Feb 28, 2025
04:40 PM
> 3. Is there any workaround to enable CEP again in Illustrator 2025, or is it completely removed?
Tried and CEP is still working in Illustrator 2025 (29.3.1). Would it solve the problem if you set the PlayerDebugMode again?
CEP-Resources/CEP_11.x/Documentation /CEP 11.1 HTML Extension Cookbook.md
... View more
Feb 26, 2025
07:27 PM
4 Upvotes
This is the code to get the information (JavaScript Object) of selected layers in Layer panel. id and index are there, so you may be able to refer to the ExtendScript Layer from it.
/**
* @Version 1.0.0
* @author sttk3.com
*/
/**
* Get the ActionDescriptor of the selected layer of activeDocument
* @Return {Array<any>} [
* {name: string, index: number, id: number, desc: ActionDescriptor}...
* ]
*/
function getSelectedLayerDesc() {
var res = [] ;
var ref1 = new ActionReference() ;
var idTargetLayers = stringIDToTypeID('targetLayers') ;
ref1.putProperty(stringIDToTypeID('property'), idTargetLayers) ;
ref1.putEnumerated(stringIDToTypeID('document'), stringIDToTypeID('ordinal'), stringIDToTypeID('targetEnum')) ;
var targetLayers = executeActionGet(ref1).getList(idTargetLayers) ;
// if there is a background layer, add 1 to index
var backgroundFactor = 0 ;
try {
activeDocument.backgroundLayer ;
} catch(e) {
backgroundFactor = 1 ;
}
var ref2, tempIndex, desc, layerItem ;
for(var i = 0, len = targetLayers.count ; i < len ; i++) {
ref2 = new ActionReference() ;
tempIndex = targetLayers.getReference(i).getIndex() + backgroundFactor ;
ref2.putIndex(stringIDToTypeID('layer'), tempIndex) ;
desc = executeActionGet(ref2) ;
layerItem = {
name: desc.getString(stringIDToTypeID('name')),
index: tempIndex,
id: desc.getInteger(stringIDToTypeID('layerID')),
desc: desc
} ;
res.push(layerItem) ;
}
return res ;
}
... View more
Feb 18, 2025
09:31 PM
1 Upvote
Since open exists as a Photoshop function, you can use it directly instead of batchPlay.
## If you let the user specify a file to open in a dialog
No specific permissions are needed to open a file. Just pass the chosen file (Entry) to open.
## If you want programmatically specify a file without GUI operation by the user Appropriate permissions are required to open the file, write `“localFileSystem”: “fullAccess”` in requiredPermissions of manifest.json.
Then, generate an Entry from the file path string using getEntryWithUrl and pass it to open.
... View more
Feb 18, 2025
12:50 AM
Thanks for the idea.
For this method, it seems that I will need to somehow move or erase only the fill appearance. I'm stuck on this part.
... View more
Feb 17, 2025
03:41 AM
1 Upvote
Simply because it is the wrong key.
... View more
Feb 14, 2025
04:41 AM
When the shortcut D is pressed, the default fill and stroke are set. With similar behavior, I want to make only stroke exactly the same as the default graphic style, without changing the current fill. This is probably not a feature in Illustrator, right?
Not only making the main properties similar, such as stroke width, but also making the appearance exactly the same. Of course I know that script can't handle the appearance, but I'm trying to find a path to achieve this in some way, such as dynamic actions or applying graphic styles. If it can be done with normal Illustrator functionality, that's fine.
Any ideas?
... View more
Feb 13, 2025
12:47 AM
1 Upvote
In other words, no errors but insufficient results? Perhaps changing it to “added from v29.3” would help.
... View more
Feb 13, 2025
12:04 AM
Found new commands in Illustrator v29.3. And overlooked, but it seems that Ungroup All was assigned a persistent menu command string in v29.2. Reinstalled and tried again, and indeed @Sergey Osokin was right, it was just ungroup. Updated to v29.3 and up.
menu
key
note
Object > Ungroup All
ungroup all
Added from v29.3
Window > Toolbars > Getting Started
Adobe Quick Toolbar Menu
Added from v29.3
... View more
Feb 12, 2025
03:42 PM
3 Upvotes
Set via Document.defaultFillColor.
/**
* @File Set fill color of TextFrame
* https://community.adobe.com/t5/illustrator-discussions/script-to-modify-fill-color-of-outline-shape-in-appearance-panel/td-p/15148110
* @Version 1.0.0
* @author sttk3.com
*/
(function() {
if(app.documents.length <= 0) {return ;}
var doc = app.documents[0] ;
var sel = doc.selection ;
if(sel.length <= 0) {return ;}
var targetItem = sel[0] ;
var newColor = new CMYKColor() ;
newColor.cyan = 100 ;
newColor.magenta = 0 ;
newColor.yellow = 0 ;
newColor.black = 0 ;
// make only targetItem selected
doc.selection = [] ;
doc.selection = [targetItem] ;
// set color
doc.defaultFillColor = newColor ;
// restore selection
doc.selection = sel ;
})() ;
... View more
Feb 12, 2025
12:43 AM
2 Upvotes
Photoshop does not seem to have a property to determine if an Action/ActionSet is selected. I checked this way.
Referring to the Action class in Photoshop UXP
Checking ActionDescriptor in Alchemist
However, batchPlay can get names of active action and its parent set, so it could be achieved by matching ID.
const { app, action } = require('photoshop') ;
const result = await action.batchPlay(
[
{
_obj: 'get',
_target: {
_ref: [
{
_enum: 'ordinal',
_ref: 'action',
_value: 'targetEnum'
}
]
}
}
],
{}
) ;
await app.showAlert(JSON.stringify(result, null, 2)) ;
/* -->
[
{
"name": "Vignette (selection)",
"itemIndex": 1,
"count": 11,
"numberOfChildren": 7,
"parentName": "Default Actions",
"parentIndex": 1,
"ID": 4
}
]
*/
... View more
Feb 06, 2025
05:59 AM
2 Upvotes
In other words, the problem was solved by my code, correct?
... View more
Feb 05, 2025
03:29 AM
2 Upvotes
Verified that it works with this UXP script.
... View more
Feb 05, 2025
02:17 AM
1 Upvote
What is the reason for that?
... View more
Feb 04, 2025
02:04 AM
3 Upvotes
Found also an ExtendScript version.
Collapse single group of layers
... View more
Feb 03, 2025
05:56 AM
3 Upvotes
It seems that layerSectionExpanded is the property being sought. Get it via batchPlay.
tokyosheep/isExpandedGroupLayer.js | GitHub Gist
How To Expand A Group | Adobe Creative Cloud Developer Forums
... View more
Jan 31, 2025
05:08 PM
Illustrator's XMPString is an Illustrator feature, see Illustrator JavaScript Scripting Reference.pdf.
If you want to use the exact same process in Illustrator, Photoshop, or another app, you can get the XMP string directly from the file via XMPFile. This can be found in the JavaScript Tools Guide.
... View more
Jan 31, 2025
12:54 AM
See Scripting Access to XMP Metadata in JavaScript Tools Guide CC.pdf.
... View more
Jan 30, 2025
07:23 PM
2 Upvotes
To add another solution, AdobeXMPScript makes it easy to parse.
... View more
Jan 28, 2025
06:16 PM
1 Upvote
m1b's way is working fine. I will add another method. Since \b represents a word boundary, if you want to force a word to have a boundary, you can use this.
/^TEST\b/
... View more
Jan 27, 2025
04:28 AM
Is it enough to use
app.executeMenuCommand('smooth menu item') ;
or
app.executeMenuCommand('simplify menu item') ;
?
... View more
Jan 25, 2025
05:49 PM
It is not necessary to be that strict in judging.
The goal is to open the file in an app that is probably appropriate In this context. Once opened, the user will look at the result and decide if they like it or not.
In other words, the script will not malfunction if it makes the wrong decision, and the user will tolerate a Photoshop EPS containing vector data or an Illustrator EPS containing raster data.
It is just a matter of being helpful if it improves accuracy.
... View more
Jan 23, 2025
04:08 AM
In the end, I decided to adopt exif:PixelXDimension. Thank you for your response.
... View more