m1b
Community Expert
m1b
Community Expert
Activity
‎Feb 28, 2025
08:20 PM
Thanks @Marc Autret, in my quick test I did notice that app.colorTransform was returning 0..1 numbers, but I was too silly to realise that it would also require 0..1 numbers, too! Haha.
- Mark
... View more
‎Feb 28, 2025
05:43 PM
Hi @SmythWharf, just for starters, are *you* able to select items on different pages (edit: I was thinking spreads) at the same time? I don't know how to do that. - Mark
Edit: Ah I think I understand now... you mean two items on unconnected pages in the same spread. Of course. Sorry.
... View more
‎Feb 28, 2025
04:23 PM
1 Upvote
Hi @imashleysantoro it sounds like this known bug. If you read that page you might get an idea of how to fix it. I had the problem and it might have been related to my font manager RightFont which I don't use any more. Honestly I'm not sure if that was the issue, but it does seem to be font-related. You might need to try a few things, such as closing fonts, or quiting font manager apps and see how you go. Good luck.
- Mark
... View more
‎Feb 28, 2025
03:43 PM
Hi @abdullh_raad027_ perhaps you could give readers an introductory paragraph explaining your project and reason for posting it on a user forum? Outlining a potential use case for this tool might be helpful too. Are you asking other users the answers to the Next Steps questions? You will get more help if you make your questions very specific and actionable, which currently they are not. Also, some of your requirements are formidable development challenges.
- Mark
P.S. Those emoji codes don't work on this forum—you can just enter the emoji directly though.
... View more
‎Feb 28, 2025
03:31 PM
Edit: I posted a script here originally, but I realised that it gives a bad result when there is text selected. I won't bother fixing it, I'll just delete it, because @Marc Autret's has found a much better way to do it, that doesn't have that problem. Please see Marc's post.
- Mark
... View more
‎Feb 28, 2025
03:32 AM
I tried it out @John37830937iqgg, but it seems to return the size of the clipping path, not the visual part of the clipping group. 😞
... View more
‎Feb 28, 2025
03:27 AM
That's a clever idea @John37830937iqgg, I'll give that a try and see if it covers the edge cases. It might be a winner!
- Mark
... View more
‎Feb 27, 2025
05:34 PM
Thanks @Joel Cherney I always forget that option. I will be interested to see if it solves the problem here. There's a solid chance, but sometimes the problem can be related to something else, such as a change in the OS.
... View more
‎Feb 27, 2025
04:15 PM
@Riannon368885617n15 great to hear!
(I see your other reply now but the forum software makes these threads very confusing to navigate! Grr.)
... View more
‎Feb 27, 2025
03:52 PM
1 Upvote
@Riannon368885617n15 did you use my updated script? If it still gives an error, I need another sample document that gives the error.
- Mark
... View more
‎Feb 27, 2025
03:48 PM
1 Upvote
Yes Robert, but it is only a sample document. On OP's machine they might be fine.
... View more
‎Feb 27, 2025
03:47 PM
1 Upvote
Yes that seems to be the problem—a carriage return in the URL. The encoded version you show from Acrobat has double-encoded the carriage return (the %250D). Normal (correct!) encoding is %0D, but if you encode that again the % is encoded as %25.
It is strange that the problem doesn't appear in the indesign one. I think the hyperlinks might be a bit messy.
... View more
‎Feb 27, 2025
03:25 PM
Hi @Textbook Perfect I haven't tried, but are you using this version? Also you could try this script, which looks great.
- Mark
... View more
‎Feb 27, 2025
03:11 PM
@Riannon368885617n15
> Interesting thing is - the URL's work when in acrobat pro or viewing the pdf
Interesting! Are you sure they are going to the *full* URL? Maybe they are missing the part after the carriage return, ie. "&utm" etc. Or maybe in the process of generating the pdf hyperlinks it automatically removes illegal characters, but not in the other process.
- Mark
... View more
‎Feb 27, 2025
03:04 PM
Thank you @Riannon368885617n15 that's helpful. I've updated my script above to work with your sample document. The bad URLs had a carriage return or linefeed in them. Please try it out the revised script.
- Mark
P.S. After reading Robert's comment, I should add that yes most of your hyperlinks were broken, but I assumed that was because you made a quick demo document. I assume they use shared destinations in another document that we don't have so they are broken. When I run my script on your demo document it fixed exactly 8 URLs. I'm not sure if that's what you expected.
... View more
‎Feb 27, 2025
01:31 PM
Hi @Meeiir I was waiting for someone knowledgeable to answer this, but no one has yet, so I'll answer as best I can, which is to say:
1. I believe CEP is still the only supported way to create extensions for Illustrator. (And plugins via the SDK).
2. UXP is not available in the released version of Illustrator.
So there might be something else going wrong for you. Unfortunately, I have no idea what it might be. I would start by attempting the most basic sample CEP extension from the Adobe CEP github and working out exactly what is going wrong. Maybe even uninstalling Illustrator and re-installing? Sorry I can't be more help.
- Mark
... View more
‎Feb 27, 2025
12:03 PM
You're welcome!
... View more
‎Feb 27, 2025
05:56 AM
1 Upvote
Yep, done that many times! Whenever I think I've found a bug, I immediately set about creating that bare bones version that I can post here and everyone can test. Usually in the process I realize what's really going on. Haha!
- Mark
... View more
‎Feb 27, 2025
05:54 AM
1 Upvote
Hey @Riannon368885617n15, can you try this script and see if it works? It's a stab in the dark, but it might do the trick.
- Mark
/**
* @file Clean Hyperlinks.js
*
* Attempts to strip bad characters from
* the active document's hyperlink URLs.
*
* @author m1b
* @version 2025-02-28
* @discussion https://community.adobe.com/t5/indesign-discussions/update-urls-to-remove-hidden-character-in-large-document-so-they-function-correctly/m-p/15180488
*/
function main() {
const illegalCharacters = /[\x00-\x1F\x7F-\x9F\u200B\u200C\u200D\n\r]+/g;
var doc = app.activeDocument,
hyperlinks = doc.hyperlinks,
counter = 0;
for (var i = 0; i < hyperlinks.length; i++) {
var hyperlink = hyperlinks[i];
try {
if ('HyperlinkURLDestination' !== hyperlink.destination.constructor.name)
continue;
} catch (error) {
// $.writeln('Hyperlink ' + i + ' links to a missing document.');
continue;
}
// quick attempt to strip bad characters
var originalURL = hyperlink.destination.destinationURL,
newURL = originalURL.replace(illegalCharacters, '');
if (newURL === originalURL)
continue;
// fix the hyperlink
hyperlink.destination.destinationURL = newURL;
counter++;
// $.writeln('Fixed Hyperlink ' + i + ' URL: ' + hyperlink.destination.destinationURL)
}
alert('Cleaned ' + counter + ' hyperlink URLs.');
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Clean Hyperlinks');
Edit 2025-02-28: changed code a bit to work with OP's sample document.
... View more
‎Feb 27, 2025
05:37 AM
1 Upvote
Hi @Jeremy bowmangraphics, it seems to be working as normal for me (Indesign 20.1, MacOS 15.3.1). Can you set up a bare bones demo document and script that shows the problem?
- Mark
... View more
‎Feb 27, 2025
03:16 AM
@aniri5j9ox8tw2ln I have made it much easier to adjust now. Just change the line:
et.minimumSize = [1000, 600];
... View more
‎Feb 27, 2025
02:52 AM
1 Upvote
@aniri5j9ox8tw2ln here is a script that collects all the linked files of all the open documents and copies them into the destination folder. Script will ask you for the destination.
- Mark
/**
* @file Collect All Documents Links.js
*
* Script will ask you to choose a folder
* and will *copy* all open documents' linked
* files into it. The Indesign documents
* won't be relinked to them, however.
*
* @author m1b
* @version 2025-02-27
* @discussion https://community.adobe.com/t5/indesign-discussions/suche-script-oder-plug-in-verknüpfungen-suchen-und-einfärben/m-p/15180561
*/
(function () {
if (0 === app.documents.length)
return alert('Please open some documents and try again.');
var destination = Folder.selectDialog();
if (
!destination
|| !destination.exists
)
return;
var paths = app.documents.everyItem().links.everyItem().filePath;
for (var i = 0; i < paths.length; i++) {
var f = File(paths[i]);
if (!f.exists)
continue;
f.copy(File(destination + '/' + f.name));
}
// reveal the destination folder
destination.execute();
})();
Edit 2025-02-27: minor typos.
... View more
‎Feb 27, 2025
02:22 AM
1 Upvote
Thanks @Laubender that's interesting. I think Apple deprecated the old HFS paths, eg. "MacintoshHD:Users:mark:Desktop".
- Mark
... View more
‎Feb 27, 2025
01:26 AM
Well for starters, here is a quick script to show you the link paths.
- Mark
/**
* Show All Link Paths.js
*
* @author m1b
* @version 2025-02-27
* @discussion https://community.adobe.com/t5/indesign-discussions/suche-script-oder-plug-in-verknüpfungen-suchen-und-einfärben/m-p/15180561
*/
(function () {
var doc = app.activeDocument,
linkPaths = doc.links.everyItem().filePath;
alerter('Link Paths for "' + doc.name + '"', linkPaths.join('\n'));
})();
/**
* Show text in a multiline edit text field.
* @version 2024-07-30
* @Param {String} title - the title of the alerter
* @Param {String|Array} input - the text content (array of strings will work).
* @Param {Number} [width] - the dialog width (default: most of screen width).
* @Param {String} [buttonTitle] - the title of the button (default: 'Close').
*/
function alerter(title, input, width, buttonTitle) {
if (input instanceof Array)
input = input.join("\r");
var w = new Window("dialog", title),
et = w.add("edittext", undefined, input, { multiline: true, scrolling: true }),
button = w.add("button", undefined, buttonTitle || "Close", { name: "ok", alignment: ['right', 'center'] });
et.minimumSize = [1000, 600];
return (1 === w.show()) ? et.text : null;
};
Edit 2025-02-27: cleaned up alerter function to make it easier for OP to adjust size.
... View more
‎Feb 27, 2025
01:20 AM
Hi @Peeyush37849741 that looks like it is on a parent spread (master page) so try going to the master and changing it manually—if it is set up right it will change on every page.
Otherwise, do a Find Text as you normally would, like this:
Is that what you mean?
- Mark
... View more
‎Feb 27, 2025
12:40 AM
@aniri5j9ox8tw2ln
> The only thing I have now noticed is that the pictures that are marked green can be found in different folders.
The script applies the label to the linked files, wherever they are. Nothing else.
Beyond that, I'm not really sure what you mean. Maybe you should do a "Package" to collect the links into one folder? Or do you only want to label *some* of the links? Or do you just want to see a list of all the paths?
- Mark
... View more
‎Feb 27, 2025
12:16 AM
2 Upvotes
Hi @Eugene Tyson yes it is definitely possible to configure the document so that running a script will restore the relationship between page items, eg. to position the button near the answer text frame. But I can't tell if that will meet Wendy's needs.
Hi @JH-Wendy would it be possible for you to describe—from the point of view of the user—how your document would work? For example, do they open a pdf, fill out a form field with their answer to a question, then click a button to trigger the actual answer to appear? If so, what is the print document like?
Without knowing more, I'm wondering if you could set up a multi-state object in Indesign, and add in a little scripting in Acrobat to do the showing/hiding. The states would show (a) The message to the user and the answer form field and the answer submit button, (b) the answer, and (c) the print version. See quick example .indd attached. Then a script can be used to toggle between state 1 and state 3 (for printing). That's one idea anyway.
- Mark
... View more
‎Feb 27, 2025
12:04 AM
2 Upvotes
Hi @aniri5j9ox8tw2ln, yes it was a change to MacOS that required a little change to the AppleScript. Here is an updated script. I made it a bit easier to use with documentation and a "FinderLabels" enum. I'll leave the old version in case it only works with older versions of MacOS, although I think this new one should work too. Let me know how it goes.
- Mark
/**
* @file Set Finder Label Of Linked Files.js
*
* Note: MacOS only due to AppleScript usage.
*
* @author m1b
* @version 2025-02-27
* @discussion https://community.adobe.com/t5/indesign-discussions/suche-script-oder-plug-in-verknüpfungen-suchen-und-einfärben/m-p/15180561
*/
(function () {
var FinderLabel = {
NONE: 0,
ORANGE: 1,
RED: 2,
YELLOW: 3,
BLUE: 4,
PURPLE: 5,
GREEN: 6,
GRAY: 7,
};
colorLinksByFinderLabelIndex(app.activeDocument, FinderLabel.GREEN);
})();
/**
* Applies a Finder label (color) to each of `doc`'s linked files.
* @author m1b
* @version 2025-02-27
* @param {Document} doc- an Indesign Document.
* @param {Number} [labelIndex] - the label to apply, a number in range 0..7 (default: 'Orange')
*/
function colorLinksByFinderLabelIndex(doc, labelIndex) {
doc = doc || app.activeDocument;
if (undefined == labelIndex)
labelIndex = 1;
var links = doc.links;
for (var i = 0; i < links.length; i++) {
var link = links[i];
// don't bother if it's missing
if (link.status == LinkStatus.LINK_MISSING) continue;
// if file exists, label it
if (!File(link.filePath).exists)
continue;
// set the label using AppleScript
var applescript = 'tell application "Finder" to set label index of (POSIX file "' + link.filePath + '" as alias) to ' + labelIndex;
app.doScript(applescript, ScriptLanguage.APPLESCRIPT_LANGUAGE);
}
};
... View more
‎Feb 26, 2025
11:15 PM
Hi @Riannon368885617n15 this might be easy to fix with a script. Can you post a sample document with some of the problematic hyperlinks in it?
- Mark
... View more
‎Feb 26, 2025
11:09 PM
Hi @lizardo_4752, you have said you need to copy the artwork from some artboards to a new document. But why do you need a script for it? It is just a matter of selecting and copy/pasting. There must be reason a script is needed. Please tell us more. 🙂
- Mark
... View more