Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Suche Script oder Plug-in: Verknüpfungen suchen und einfärben

Enthusiast ,
Jan 26, 2022 Jan 26, 2022

Copy link to clipboard

Copied

Hallo!

Viele viele Jahre ist es her, aber ich kann mich erinnern dass es für Indesign einen Script oder Plug-in gab, wo mir alle verwendeten Verknüpfungen in einem Dokument in den verschiedenen Ordner im Finder suchte und z.b. Grün einfärbte. Ich weiß es gibt die Paket-Funktion, aber manchmal möchte man die Ordner mit jede Menge Bilder behalten und nur die im Dokument verwendeten Verknüpfungen gekennzeichnet haben. 

 

Kennt jemand noch diese Funktion? Ich finde leider mit Google nichts...

Dankeschön!

TOPICS
Feature request , How to , Scripting

Views

1.3K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 27, 2022 Jan 27, 2022

This script will apply the green label to each link in the active document.

- Mark

 

Edit 2025-02-27: UPDATE This old script will throw an error on newer versions of MacOS, so see the updated script below.

 

 

colorLinksByFinderLabelIndex(app.activeDocument, 6);  // 6 = GREEN


function colorLinksByFinderLabelIndex(doc, labelIndex) {
    // labelIndex is a Number in range 0-7
    doc = doc || app.activeDocument;
    labelIndex = labelIndex || 2;
    var links = doc.links;

    for (var i = 0; i 
...

Votes

Translate
Enthusiast ,
Jan 26, 2022 Jan 26, 2022

Copy link to clipboard

Copied

Die englische Übersetzung ist nicht ganz korrekt, ich meine für Verknüpfungen die "Links"!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 26, 2022 Jan 26, 2022

Copy link to clipboard

Copied

Hallo aniri5j9ox8tw2ln,

mit welchem Mac OS bist Du unterwegs?

 

Wenn, dann müsste man das mit Apple-Script gehen.

Die verlinkten Dateien auslesen und denen dann eine Eigenschaft verpassen.

 

Bin aber auf Windows 10 unterwegs und bei der praktischen Umsetzung keine Hilfe.

Dort gibt's das Einfärben von Dateien im Dateisystem nicht.

 

Gruß,
Uwe Laubender

( ACP )

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 26, 2022 Jan 26, 2022

Copy link to clipboard

Copied

Ich bin mit MacOs Monterey unterwegs...

Hmm dann werde ich mich mal informieren ob ich Hilfe bezgl. Apple Script bekommen kann.

Danke!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 26, 2022 Jan 26, 2022

Copy link to clipboard

Copied

Hi,

 

ich kenne das Script nicht, aber:
die Bridge kann dir alle Verknüpfungen eines InDesign Dokuments in der Metadaten-Palette anzeigen und über Ansicht -> Verknüpfte Dateien anzeigen fasst sie dir alle Links in der Anzeige zusammen/zeigt nur die Links an.

Je nachdem, was du vorhast...

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 26, 2022 Jan 26, 2022

Copy link to clipboard

Copied

Danke! An sich ist das auch eine tolle Funktion von Bridge, aber nicht genau das was ich suchte...

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 27, 2022 Jan 27, 2022

Copy link to clipboard

Copied

This script will apply the green label to each link in the active document.

- Mark

 

Edit 2025-02-27: UPDATE This old script will throw an error on newer versions of MacOS, so see the updated script below.

 

 

colorLinksByFinderLabelIndex(app.activeDocument, 6);  // 6 = GREEN


function colorLinksByFinderLabelIndex(doc, labelIndex) {
    // labelIndex is a Number in range 0-7
    doc = doc || app.activeDocument;
    labelIndex = labelIndex || 2;
    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)
            app.doScript('tell application "Finder" to set label index of (alias "' + link.filePath + '") to ' + labelIndex, ScriptLanguage.APPLESCRIPT_LANGUAGE);
    }
}

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 27, 2022 Jan 27, 2022

Copy link to clipboard

Copied

hello Mark!

Great, it works! I thank you so much for your help :))))

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 26, 2025 Feb 26, 2025

Copy link to clipboard

Copied

Hello Mark, I don't know why but your script doesn't work anymore. I get an error message. Did something change because Indesign is now a different version? Thank you!

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 26, 2025 Feb 26, 2025

Copy link to clipboard

Copied

@aniri5j9ox8tw2ln said: " … I get an error message".

 

Hi @aniri5j9ox8tw2ln ,

what does that message say?

Well, and did you update your macOS recently?

What version are you running?

Perhaps something on the AppleScript side of coding changed?

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 26, 2025 Feb 26, 2025

Copy link to clipboard

Copied

Ja, seit dem Script habe ich sei es OS als ID Version geändert, den Script habe ich nicht mehr so oft verwendet. Heute wollte ich mal das Problem lösen, da mir aufgefallen ist dass er nicht mehr funktioniert...

MacOS Sequoia 15.3.1 und InDesign 20.1

Fehler ist: 

aniri5j9ox8tw2ln_0-1740642284694.pngexpand image

Hat es vielleicht mit diesem Link zu tun, was nicht als "6" gesetzt werden kann?

Aber eine Fehlermeldung bekomme ich bei jedem Dokument wenn ich den Script probiere, es wird dann halt ein anderer Link aufgezählt im Pfad...

 

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

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);

    }

};

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

Perfect Mark, now it works again! Thank you!

The only thing I have now noticed is that the pictures that are marked green can be found in different folders. Either I filter in the Finder with the tag "Green" to find the links, or if it would be possible to expand the script by possibly listing the exact paths to the folders in a new window. That would also be practical...

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

@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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

I just want to see a list of all paths - that would help...

 

Or now that I think again, the above script is great for one purpose - but is there also a script where a single "Link" package is made of all the opened documents that i have in ID?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

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.

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

Interesting Script!

But I have a problem, the window is very big - I try to change alone the height value in the script...

Nope, I can't handle it 😞

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

@aniri5j9ox8tw2ln I have made it much easier to adjust now. Just change the line:

et.minimumSize = [1000, 600];

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

The window is unfortunately still too big and the part with the close button is always hidden, I can only close the window with Enter (fortunately)...

 

edit: now its perfect and works with the old lines in the script before: 

et.maximumSize.height = w.maximumSize.height - 950;
et.preferredSize.height = w.maximumSize.height - 600;
et.minimumSize = [2000, 1000];

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

@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.

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

Excellent!

Thank you very much, this is very helpful

🙂

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

quote

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

By m1b

 

May I only add one note:

 

This script won't collect assets linked to InDesign links. For example, if a placed .ai file has linked images, or a placed .indd file has links, those links won't be collected. Obviously, I don't know if it's important to OP.

 

If it is important, then a workaround would be to use the package command on each InDesign file (which will collect all nested links), then move all links into a single folder.

 

p.s. EDIT: ...or create a book that contains the desired files, then package the book.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

LATEST

Thanks for the comment...

 

It happens that I place .ai files (rarely .indd files), but I usually only use the .ai files for vector graphics without linked images, and when I usually embed the images in the .ai file.

 

But I will keep it in mind so that I can do an additional check with these links when I use this script.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

Hi Mark,

just to let you know:

 

Your old version of the script is running without any flaw on:

macOS Monterey 12.7.1

InDesign 2023 version 18.5.4.138

 

On the same machine and macOS it will not run with InDesign 2024 or InDesign 2025.

I assume to the switch to POSIX path definitions that came with InDesign 2024.

 

Your new version of the script is running successfully without error on:

macOS Monterey 12.7.1

InDesign 2024 version 19.5.2.129

InDesign 2025 version 20.1.0.71

 

It throws an error with:

InDesign 2023 version 18.5.4.138

 

Error script v2 with InDesign 2023.pngexpand image

 

Thanks,
Uwe Laubender
( Adobe Community Expert )

 

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 27, 2025 Feb 27, 2025

Copy link to clipboard

Copied

Thanks @Laubender that's interesting. I think Apple deprecated the old HFS paths, eg. "MacintoshHD:Users:mark:Desktop".

- Mark

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines