Relinken op type foto i.p.v. bestandsnaam - opties?

Pagina: 1
Acties:

Onderwerpen

Vraag


Acties:
  • 0 Henk 'm!

  • MaStar
  • Registratie: November 2003
  • Laatst online: 10:09
Ik heb ik Indesign een Project met zo'n 500 foto's. De foto's verwezen naar een hardeschijf die helaas is gecrasht. Ik heb een back-up, echter op de gecrashte hardeschijf (en daarmee de koppeling in Indesign) hadden de foto's een gewijzigde naam:

dscf7618_45503705025_o.jpg
dscf7619_93723242000_o.jpg
(hier zit geen duidelijke structuur in helaas, door het 2e deel van de nummers)

Terwijl in de back-up map ze de reguliere file-naam hebben waarbij alleen het eerste deel van de file-naam overeen komt: DSCF7618.

Nu kan ik de 500 foto's 1 voor 1 relinken, echter is het handiger als Indesign de foto's automatisch kan opzoeken. Echter matchen de bestandsnamen op die 500 niet, waardoor dit niet in één keer kan.

Update 1:
In dit topic wordt een soortgelijk probleem en een script gedeeld:
https://graphicdesign.sta...ension-but-different-name

Ik heb dat script gerunt, echter vindt hij de missing files helaas niet .

Kent iemand opties hoe dit op een andere manier kan?

[ Voor 40% gewijzigd door MaStar op 02-01-2021 18:37 ]

Beste antwoord (via MaStar op 03-01-2021 10:06)


  • Charango
  • Registratie: Juni 2001
  • Laatst online: 05-07 21:59
Het zoeken in submappen gaat me te ver, dus je kan ofwel alle bestanden van de backup in één map plaatsen, of het script voor elke subfolder apart runnen, of iemand zoeken die deze functionaliteit wil toevoegen.

Hoofdletters en kleine letters worden genegeerd in de volgende versie (en de eerste 8 letters worden vergeleken, in de vorige versie bleken dat er 7 te zijn):

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//DESCRIPTION: Find lost images by partial name match (first 8 characters)
// adaptation of a Rad Lexus Script

if (!app.documents.length)
{
    alert ('please open a document first');
    exit();
}

problems = [];

path = Folder(app.activeDocument.filePath).selectDlg("Select file source");
if (path)
{
    // load the images in this folder
    filelist = path.getFiles ('*.*');

    // loop over the linked images
    for (i=0; i<app.activeDocument.allGraphics.length; i++)
    {
        // is it a linked file?
        if (app.activeDocument.allGraphics[i].itemLink && app.activeDocument.allGraphics[i].itemLink.needed)
        {
            partialLinkName = app.activeDocument.allGraphics[i].itemLink.name.substring(0,8).toLowerCase()
            
            // check for matching partial file names in the file list
            matches = [];
            for (j=0; j<filelist.length; j++)
            {
                partialFileName = filelist[j].name.substring(0,8).toLowerCase()
                if (partialLinkName == partialFileName)
                {
                    matches.push (filelist[j]);
                }
            }
            // did we find a match?
            if (matches.length == 1)
            {
                app.activeDocument.allGraphics[i].itemLink.relink (matches[0]);
            } else
            {
                if (matches.length == 0)
                    problems.push ('no match for '+app.activeDocument.allGraphics[i].itemLink.filePath);
                else
                    problems.push ('multiple matches for '+app.activeDocument.allGraphics[i].itemLink.filePath);
            }
        }
    }
    if (problems.length)
        alert (problems.join('\r'), 'Problems');
}

Alle reacties


Acties:
  • +2 Henk 'm!

  • Charango
  • Registratie: Juni 2001
  • Laatst online: 05-07 21:59
Hebben de gelinkte foto's dus wel dezelfde eerste acht tekens in de bestandsnaam als de foto's in je backup? Zo ja, dan zou een kleine aanpassing van dat script voldoende zijn: in plaats van het vergelijken van de bestandsgrootte zou je dan het eerste deel van de naam moeten vergelijken.

Edit: ik heb het gelijk maar geprobeerd, zie onder.

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//DESCRIPTION: Find lost images by partial name match (first 8 characters)
// adaptation of a Rad Lexus Script

if (!app.documents.length)
{
    alert ('please open a document first');
    exit();
}

problems = [];

path = Folder(app.activeDocument.filePath).selectDlg("Select file source");
if (path)
{
    // load the images in this folder
    filelist = path.getFiles ('*.*');

    // loop over the linked images
    for (i=0; i<app.activeDocument.allGraphics.length; i++)
    {
        // is it a linked file?
        if (app.activeDocument.allGraphics[i].itemLink && app.activeDocument.allGraphics[i].itemLink.needed)
        {
            partialLinkName = app.activeDocument.allGraphics[i].itemLink.name.substring(0,7)
            
            // check for matching partial file names in the file list
            matches = [];
            for (j=0; j<filelist.length; j++)
            {
                partialFileName = filelist[j].name.substring(0,7)
                if (partialLinkName == partialFileName)
                {
                    matches.push (filelist[j]);
                }
            }
            // did we find a match?
            if (matches.length == 1)
            {
                app.activeDocument.allGraphics[i].itemLink.relink (matches[0]);
            } else
            {
                if (matches.length == 0)
                    problems.push ('no match for '+app.activeDocument.allGraphics[i].itemLink.filePath);
                else
                    problems.push ('multiple matches for '+app.activeDocument.allGraphics[i].itemLink.filePath);
            }
        }
    }
    if (problems.length)
        alert (problems.join('\r'), 'Problems');
}

[ Voor 77% gewijzigd door Charango op 02-01-2021 20:10 . Reden: script toegevoegd ]


Acties:
  • 0 Henk 'm!

  • MaStar
  • Registratie: November 2003
  • Laatst online: 10:09
Charango schreef op zaterdag 2 januari 2021 @ 19:46:
Hebben de gelinkte foto's dus wel dezelfde eerste acht tekens in de bestandsnaam als de foto's in je backup? Zo ja, dan zou een kleine aanpassing van dat script voldoende zijn: in plaats van het vergelijken van de bestandsgrootte zou je dan het eerste deel van de naam moeten vergelijken.

Edit: ik heb het gelijk maar geprobeerd, zie onder.

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//DESCRIPTION: Find lost images by partial name match (first 8 characters)
// adaptation of a Rad Lexus Script

if (!app.documents.length)
{
    alert ('please open a document first');
    exit();
}

problems = [];

path = Folder(app.activeDocument.filePath).selectDlg("Select file source");
if (path)
{
    // load the images in this folder
    filelist = path.getFiles ('*.*');

    // loop over the linked images
    for (i=0; i<app.activeDocument.allGraphics.length; i++)
    {
        // is it a linked file?
        if (app.activeDocument.allGraphics[i].itemLink && app.activeDocument.allGraphics[i].itemLink.needed)
        {
            partialLinkName = app.activeDocument.allGraphics[i].itemLink.name.substring(0,7)
            
            // check for matching partial file names in the file list
            matches = [];
            for (j=0; j<filelist.length; j++)
            {
                partialFileName = filelist[j].name.substring(0,7)
                if (partialLinkName == partialFileName)
                {
                    matches.push (filelist[j]);
                }
            }
            // did we find a match?
            if (matches.length == 1)
            {
                app.activeDocument.allGraphics[i].itemLink.relink (matches[0]);
            } else
            {
                if (matches.length == 0)
                    problems.push ('no match for '+app.activeDocument.allGraphics[i].itemLink.filePath);
                else
                    problems.push ('multiple matches for '+app.activeDocument.allGraphics[i].itemLink.filePath);
            }
        }
    }
    if (problems.length)
        alert (problems.join('\r'), 'Problems');
}
Dank voor het delen! Ik krijg helaas een pop-up met volle lijst van "Problems" en "no match found".
Charango schreef op zaterdag 2 januari 2021 @ 19:46:
Hebben de gelinkte foto's dus wel dezelfde eerste acht tekens in de bestandsnaam als de foto's in je backup?
Ja, de eerste 8 tekens, maar wel met hoofdletter i.p.v. kleine letter.

De file in Indesign er zo uit : dscf7618_45503705025_o.jpg En de file-name in de back-up (diverse submappen) zo: DSCF7618

Verschil zit dus ook in hoofdletters versus kleine letters, en dat de Indesign link dus cijfer heeft met _0232323 (een willekeurig random nummer).

[ Voor 5% gewijzigd door MaStar op 02-01-2021 23:43 ]


Acties:
  • Beste antwoord
  • +1 Henk 'm!

  • Charango
  • Registratie: Juni 2001
  • Laatst online: 05-07 21:59
Het zoeken in submappen gaat me te ver, dus je kan ofwel alle bestanden van de backup in één map plaatsen, of het script voor elke subfolder apart runnen, of iemand zoeken die deze functionaliteit wil toevoegen.

Hoofdletters en kleine letters worden genegeerd in de volgende versie (en de eerste 8 letters worden vergeleken, in de vorige versie bleken dat er 7 te zijn):

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//DESCRIPTION: Find lost images by partial name match (first 8 characters)
// adaptation of a Rad Lexus Script

if (!app.documents.length)
{
    alert ('please open a document first');
    exit();
}

problems = [];

path = Folder(app.activeDocument.filePath).selectDlg("Select file source");
if (path)
{
    // load the images in this folder
    filelist = path.getFiles ('*.*');

    // loop over the linked images
    for (i=0; i<app.activeDocument.allGraphics.length; i++)
    {
        // is it a linked file?
        if (app.activeDocument.allGraphics[i].itemLink && app.activeDocument.allGraphics[i].itemLink.needed)
        {
            partialLinkName = app.activeDocument.allGraphics[i].itemLink.name.substring(0,8).toLowerCase()
            
            // check for matching partial file names in the file list
            matches = [];
            for (j=0; j<filelist.length; j++)
            {
                partialFileName = filelist[j].name.substring(0,8).toLowerCase()
                if (partialLinkName == partialFileName)
                {
                    matches.push (filelist[j]);
                }
            }
            // did we find a match?
            if (matches.length == 1)
            {
                app.activeDocument.allGraphics[i].itemLink.relink (matches[0]);
            } else
            {
                if (matches.length == 0)
                    problems.push ('no match for '+app.activeDocument.allGraphics[i].itemLink.filePath);
                else
                    problems.push ('multiple matches for '+app.activeDocument.allGraphics[i].itemLink.filePath);
            }
        }
    }
    if (problems.length)
        alert (problems.join('\r'), 'Problems');
}

Acties:
  • 0 Henk 'm!

  • MaStar
  • Registratie: November 2003
  • Laatst online: 10:09
Charango schreef op zondag 3 januari 2021 @ 02:27:
Het zoeken in submappen gaat me te ver, dus je kan ofwel alle bestanden van de backup in één map plaatsen, of het script voor elke subfolder apart runnen, of iemand zoeken die deze functionaliteit wil toevoegen.

Hoofdletters en kleine letters worden genegeerd in de volgende versie (en de eerste 8 letters worden vergeleken, in de vorige versie bleken dat er 7 te zijn):

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//DESCRIPTION: Find lost images by partial name match (first 8 characters)
// adaptation of a Rad Lexus Script

if (!app.documents.length)
{
    alert ('please open a document first');
    exit();
}

problems = [];

path = Folder(app.activeDocument.filePath).selectDlg("Select file source");
if (path)
{
    // load the images in this folder
    filelist = path.getFiles ('*.*');

    // loop over the linked images
    for (i=0; i<app.activeDocument.allGraphics.length; i++)
    {
        // is it a linked file?
        if (app.activeDocument.allGraphics[i].itemLink && app.activeDocument.allGraphics[i].itemLink.needed)
        {
            partialLinkName = app.activeDocument.allGraphics[i].itemLink.name.substring(0,8).toLowerCase()
            
            // check for matching partial file names in the file list
            matches = [];
            for (j=0; j<filelist.length; j++)
            {
                partialFileName = filelist[j].name.substring(0,8).toLowerCase()
                if (partialLinkName == partialFileName)
                {
                    matches.push (filelist[j]);
                }
            }
            // did we find a match?
            if (matches.length == 1)
            {
                app.activeDocument.allGraphics[i].itemLink.relink (matches[0]);
            } else
            {
                if (matches.length == 0)
                    problems.push ('no match for '+app.activeDocument.allGraphics[i].itemLink.filePath);
                else
                    problems.push ('multiple matches for '+app.activeDocument.allGraphics[i].itemLink.filePath);
            }
        }
    }
    if (problems.length)
        alert (problems.join('\r'), 'Problems');
}
Dit werkt. Held _/-\o_ :)