Aprking
Contributor
Aprking
Contributor
Activity
Nov 21, 2023
05:58 AM
@m1bThe information output by the above JSX script appears as garbled characters in versions of Illustrator running in Chinese, Japanese, and other non-English languages. Currently, I am not aware if the information output is abnormal in all other non-English language versions of Illustrator.
... View more
Nov 21, 2023
12:20 AM
@Sergey Osokin I have tried doing it myself, but I still got the same result which is garbled characters. I suspect that ink.name does not support non-English language environments. However, I still appreciate your response!
... View more
Nov 20, 2023
11:08 PM
4 Upvotes
The illustrator script cannot support Chinese, Japanese and other languages when getting ink.name, and it displays garbled characters. Seeking guidance and assistance from the community's experts. Thank you, everyone! var doc = app.activeDocument;
var inkList = doc.inkList;
var inkUsage = [];
for (var i = 0; i < inkList.length; i++) {
var ink = inkList[i];
var inkName = ink.name;
inkUsage.push(inkName);
}
alert(inkUsage.join("\n"));
$.write(inkUsage.join("\n"));
... View more
Oct 11, 2023
03:03 AM
Thank you for your reply. I'm trying to separate the GroupItem and process it separately, and there is always a solution. Also, looking forward to a master appearing.
... View more
Oct 11, 2023
01:01 AM
Your guess proves that you are very intelligent. This test file does indeed contain PluginItem, path, CompoundPathItem, and GroupItem, so there are always some objects that cannot be moved or scaled correctly.
... View more
Oct 10, 2023
07:03 PM
Thank you for your help! However, the code still hasn't solved this problem.
... View more
Oct 10, 2023
07:10 AM
When I try to move and scale selected objects in Illustrator using a script, the unexpanded Compound Shapes cannot be moved correctly, while other objects or groups (including unexpanded Compound Shapes) can be moved correctly. Can anyone guide me on how to modify the JSX script to properly move these objects? var doc = app.activeDocument;
var selection = doc.selection;
var moveX = 10;
var moveY = 20;
var scaleX = 0.9;
var scaleY = 0.8;
for (var i = 0; i < selection.length; i++) {
var item = selection[i];
if (item.parent instanceof GroupItem) {
continue;
}
item.resize(
scaleX * 100, // x
scaleY * 100, // y
true, // changePositions
true, // changeFillPatterns_value
true, // changeFillGradients
true, // changeStrokePattern
1 ? Math.sqrt(scaleX * scaleY) * 100 : 100,
Transformation.TOPLEFT
);
item.left += moveX;
item.top -= moveY;
}
... View more
Aug 31, 2023
10:18 AM
Thank you very much for your response! I originally planned to use ‘art_’ for variable naming, but now I’m prepared to use the artboard name for variable naming. Of course, your method may be more convenient. Also, does ‘ExportForScreensType.SE_JPEG100’ have only four values: 20_50_80_100? Thanks again for your response!
... View more
Aug 31, 2023
07:12 AM
Hello everyone! I have a question about using a script in Illustrator to export JPEGs. When using the following code: doc.exportForScreens(jpegOutPath, ExportForScreensType.SE_JPEG100, jpegOptions, whatToExport, 'art_'); the exported JPEG file names contain the name of the artboard. How can I export the JPEGs without the artboard name in the file name? Thank you!
... View more
Aug 16, 2023
08:02 AM
1 Upvote
Hello @femkeblanco , thank you very much for your help. The statement checkbox.spotColor.color = checkbox.spotColor.color; is very cleverly used, our original method was clumsy, as shown below: if (checkbox.value) {
var cmykColor = new CMYKColor();
cmykColor.cyan = checkbox.spotColor.color.cyan;
cmykColor.magenta = checkbox.spotColor.color.magenta;
cmykColor.yellow = checkbox.spotColor.color.yellow;
cmykColor.black = checkbox.spotColor.color.black;
checkbox.spotColor.color = cmykColor;
checkbox.spotColor.colorType = ColorModel.PROCESS;
} In addition, how can I use a script to find spot colors in Illustrator that are using the Lab color mode? Personally, I think the best approach is to handle the spot colors using the method mentioned earlier if they are in the Lab color mode, and directly convert other color modes that can be converted normally (e.g., RGB or HSB), while preserving their original color mode.
... View more
Aug 15, 2023
10:39 AM
2 Upvotes
Hello friends! How to use scripts in Illustrator to find spot color swatches with the color mode set as Lab in a document and convert them to global colors while retaining the Lab color mode? The script below will encounter an error and stop the conversion when it encounters Lab color mode: var doc = app.activeDocument;
var spotColors = doc.spots;
var dialog = new Window("dialog", "Convert Spot Colors to Global");
var panel = dialog.add("panel", undefined, "Select the spot colors to convert");
panel.orientation = "column";
panel.alignChildren = ["left","top"];
panel.spacing = 10;
panel.margins = 20;
for (var i = 0; i < spotColors.length; i++) {
var spotColor = spotColors[i];
if (spotColor.colorType === ColorModel.REGISTRATION || spotColor.colorType === ColorModel.PROCESS) {
continue;
}
var checkbox = panel.add("checkbox", undefined, spotColor.name);
checkbox.value = true;
checkbox.spotColor = spotColor;
}
if (panel.children.length === 0) {
alert("There are no spot colors in the current document!", "Reminder!");
} else {
var buttonsGroup = dialog.add("group");
buttonsGroup.alignment = "center";
buttonsGroup.add("button", undefined, "OK", { name: "ok" });
buttonsGroup.add("button", undefined, "Cancel", { name: "cancel" });
dialog.defaultElement = buttonsGroup.children[0];
buttonsGroup.ok.onClick = function () {
for (var i = 0; i < panel.children.length; i++) {
var checkbox = panel.children[i];
if (checkbox.value) {
checkbox.spotColor.colorType = ColorModel.PROCESS;
}
}
dialog.close();
};
buttonsGroup.cancel.onClick = function () {
dialog.close();
};
dialog.show();
}
... View more
Jul 20, 2023
10:48 AM
It seems that there are many parameters for the preferences supported in InDesign, which is different from Illustrator. Comparing the differences in script parameters between these two software is an interesting thing. Thanks again!
... View more
Jul 20, 2023
09:57 AM
According to your method, I have successfully scaled the strokes and effects along with the object. However, there is a bug in CC2014 where the stroke weight displayed in the Stroke panel is the same, even though they are actually different. Additionally, the options in the Transform panel do not change with the script. In CC2023, all of these bugs are completely resolved. Summary: The resize() method does not support scaling stroke and other parameters. Instead, transform() or Scale should be used. This is different from the resize() function in Illustrator. Please guide me if my understanding is correct. You are a great teacher, and I appreciate your help once again!
... View more
Jul 20, 2023
08:34 AM
A. var transformPrefs = myObject.transformPreferences; retrieves the original properties of the document. B. When scaling the object, transformPrefs.adjustEffectsWhenScaling = true; is used to specify scaling effects simultaneously. C. Then, myObject.transformPreferences = transformPrefs; restores the original values. Is this the correct understanding?
... View more
Jul 20, 2023
08:24 AM
Hi @rob day , it's great to see you again. I have looked at the resources you shared, and it seems that my approach to searching for information was incorrect. Additionally, is it true that InDesign does not have parameters like Illustrator's Resize, which allows for scaling strokes and effects simultaneously? How can I achieve scaling effects in InDesign? I apologize for any inconvenience caused and thank you once again
... View more
Jul 20, 2023
07:13 AM
2 Upvotes
Hello everyone! When I was searching for information to write scripts for InDesign, I found that some parameters are not easily obtained. For example, I want to resize an object while scaling its strokes and effects. In the Illustrator scripting manual, all the parameters are easily available, such as: resize
(scaleX,
scaleY
[,changePositions]
[,changeFillPatterns]
[,changeFillGradients]
[,changeStrokePattern]
[,changeLineWidths]
[,scaleAbout]) or translate
([deltaX]
[,deltaY]
[,transformObjects]
[,transformFillPatterns]
[,transformFillGradients]
[,transformStrokePatterns]) However, the InDesign scripting manual does not provide similar comprehensive script constant parameters. I believe that I might be using the wrong search method or the information I found is incomplete. So, I would like to ask the community for help. How can I access resources for InDesign in this regard and how can I solve the issue of scaling strokes and effects while resizing objects? Thank you!
... View more
Jul 18, 2023
06:54 AM
1 Upvote
Hi @Peter Kahrel it worked! Thank you very much. It is thanks to helpful friends like you that this place has become such an amazing community. Thanks again!
... View more
Jul 17, 2023
09:02 AM
This might be a simple question, but it has been puzzling me for a long time. I couldn't find a solution when searching online, and it is related to the UI of ESKT. That's why I came here to seek help from friends.
... View more
Jul 17, 2023
08:36 AM
Sorry! I'm asking this question in this section because I'm working on a UI panel for InDesign and I need this functionality. However, this question does not directly fall within the scope of InDesign knowledge, so I apologize once again!
... View more
Jul 17, 2023
08:19 AM
1 Upvote
I often see others using ICON's icon files \u0089PNG\r\n, but I have always been unclear about how this format of text is converted from a PNG image. Now, I need to embed an icon in UI programming with JavaScript, so please help guide me on how to convert PNG to \u0089PNG\r\n.
... View more
Jun 30, 2023
09:26 AM
BridgeTalk can be annoying as it opens InDesign simultaneously. This method is not very user-friendly!
... View more
Jun 30, 2023
09:23 AM
1 Upvote
I have written a script in Photoshop to retrieve ADOBE PDF presets, but it is only compatible with Windows 10 and above. However, the same approach should work for adapting it to Mac. /*
* #target Photoshop
* Author: Aprking
* Contact: aprking@hotmail.com
*/
if (BridgeTalk.appName == "photoshop") {
var userName = getCurrentUsername();
}
function getCurrentUsername() {
var userName = $.getenv("USERNAME");
if (!userName) {
userName = $.getenv("USER");
}
return userName;
}
var dialog = new Window("dialog");
dialog.text = "Select PDF Preset";
dialog.orientation = "column";
dialog.alignChildren = "left";
var presetsDropdown = dialog.add("dropdownlist");
presetsDropdown.preferredSize.width = 200;
var loadButton = dialog.add("button", undefined, "Load");
loadButton.onClick = loadSelectedPreset;
var pdfPresets = getPDFPresets();
for (var i = 0; i < pdfPresets.length; i++) {
var presetName = pdfPresets[i];
presetsDropdown.add("item", presetName);
}
presetsDropdown.selection = presetsDropdown.items[1];
dialog.show();
function getPDFPresets() {
var presetFolderPath1 = "C:\\Users\\" + userName + "\\AppData\\Roaming\\Adobe\\Adobe PDF\\Settings";
var presetFolderPath2 = "C:\\ProgramData\\Adobe\\Adobe PDF\\Settings";
var folder1 = new Folder(presetFolderPath1);
var folder2 = new Folder(presetFolderPath2);
var files1 = folder1.getFiles("*.joboptions");
var files2 = folder2.getFiles("*.joboptions");
var presets = [];
for (var i = 0; i < files1.length; i++) {
var file1 = files1[i];
var name1 = file1.name.replace(/\.joboptions$/, "");
presets.push(decodeURIComponent(name1));
}
for (var i = 0; i < files2.length; i++) {
var file2 = files2[i];
var name2 = file2.name.replace(/\.joboptions$/, "");
presets.push(decodeURIComponent(name2));
}
return presets;
}
function loadSelectedPreset() {
var selectedIndex = presetsDropdown.selection.index;
var selectedPreset = pdfPresets[selectedIndex];
alert("Loaded PDF Preset: " + selectedPreset);
}
... View more
Jun 29, 2023
08:49 AM
I am working on a script to export layers to PDF, but I have encountered an issue. This is something I already know how to do in InDesign and Illustrator. How to use a script to retrieve existing ADOBE PDF presets in Photoshop using a dropdown menu? I kindly request assistance from friends. For example, the method to retrieve presets in Illustrator is as follows. var presetNames = app.PDFPresetsList;
var presetList = presetGroup.add("dropdownlist", [0, 0, 220, 25]);
for (var i = 0; i < presetNames.length; i++) {
presetList.add("item", presetNames[i]);
} Does Photoshop have a similar method?
... View more
Jun 28, 2023
09:43 AM
var preflightName = preflightDropdown.selection.text; if (preflightName === "[Basic]") { preflightName = 0; } The test has been passed. Thank you for @rob day assistance!
... View more
Jun 28, 2023
09:27 AM
I think I understand now. [Basic] = 0. So when [Basic] is selected from the dropdown menu, I need to convert it to 0 instead of directly using its name like the others.
... View more
Jun 28, 2023
09:03 AM
Hello, Rob Day! Nice to see you again today. According to what should be, [Basic] is the first option, so it should be var bpf = app.preflightProfiles.item(0), but when I try to get the [Basic] from the dropdown menu in INDESIGN, it throws an error, which confuses me. I even tried "Basic""[Basic]""basic", but none of them worked.
... View more
Jun 28, 2023
08:06 AM
2 Upvotes
When scripting the batch export of PDF files in INDESIGN, I encountered an issue with retrieving the preflight profile configuration. The problem lies in the fact that the default first value is "[Basic]," which would cause an error if passed to the following code: var preflightProfile = app.preflightProfiles.item(preflightName); since "[Basic]" is not a valid value. However, all other options from the dropdown menu work correctly. What is the correct value for [Basic]?
... View more
Jun 27, 2023
09:03 AM
Currently, I am using a script to retrieve the properties of selected text and fill them into the GREP section of the Find/Change panel for search and replace. However, after obtaining the text properties, I still have to manually open the Find/Change panel by pressing Ctrl+F. It would be much more convenient if I could directly open the Find/Change panel after retrieving the text properties using the script. But now, I cannot determine the hidden and visible state of the Find/Change panel. So... For example, if the Find/Change panel is currently hidden, and I run the script, the Find/Change panel becomes visible... Hahaha... This is a pretty funny situation.
... View more
Jun 27, 2023
08:42 AM
I'm sorry, I wanted to discuss scripting techniques rather than operational issues.
... View more
- « Previous
- Next »