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

search script for open/update link/export to pdf

Explorer ,
Oct 03, 2022 Oct 03, 2022

Copy link to clipboard

Copied

hi, recently i receive an answer for use batch_converter script, it work fine, but not fully, because we can export pdf only in root folder

 

 

and i search a script for do same thing but in same folder than source and with same name, and able to overwrite if existing

 

 

thanks in advance

TOPICS
Import and export , Scripting

Views

457

Translate

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 ,
Oct 03, 2022 Oct 03, 2022

Copy link to clipboard

Copied

Are you talking about the script described in the following link

https://creativepro.com/files/kahrel/indesign/batch_convert.html

If yes then I see the options for overwriting the files and also setting the output folder. If you are referring to some other script, share as to from where did you download the script

-Manan

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

hi, yes, the problem is

 

the export file is in root folder

i need to export in same folder than source file

Votes

Translate

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 ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

Laurence -- I answered that in the other thread: hover the mouse pointer over the 'Output folder' field an you'll see a text balloon that explains it. It's also on the script's web page: leave the 'Output folder''s text field blank and check 'Include subfolders'. That way all PDFs are saved in the same folders that the indds are in.

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

cool i will test asap

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

i do an other thread because request is different

 

how to do for just open inff files, update all, save and close without export?

Votes

Translate

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
Advisor ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

@laurence roussel12011930,

 

The thread: https://community.adobe.com/t5/indesign-discussions/search-script-for-open-update-link-save-close-in... Has been locked.

 

You can give this script a try to open .indd files, update all, save and close without exporting.

var topFolder = (Folder.selectDialog("Select the top level folder."))
var fileandfolderArray = scanSubFolders(topFolder,/\.(indd)$/i);

var fileList = fileandfolderArray[0];

for (var i = 0; i < fileList.length; i++) {
var myFile = fileList[i];
   
app.open(myFile);

while (app.documents.length > 0) { 

var doc = app.activeDocument;

doc.links.everyItem().update();

doc.close(SaveOptions.YES);

  }
}
alert("Done updating and saving files!")

function scanSubFolders(tFolder, scanMask){
    var subFolders = new Array();
    var allFiles = new Array();
    subFolders[0] = tFolder;
    for (var j = 0; j < subFolders.length; j++){    
        var procFiles = subFolders[j].getFiles();
        for (var i = 0; i< procFiles.length; i++){
            if (procFiles[i] instanceof File ){
                if(scanMask == undefined) allFiles.push(procFiles[i]);
                if (procFiles[i].fullName.search(scanMask) != -1) allFiles.push(procFiles[i]);
        }else if (procFiles[i] instanceof Folder){
            subFolders.push(procFiles[i]);
            scanSubFolders(procFiles[i], scanMask);
         }
      }
   }
   return [allFiles,subFolders];
};

Regards,

Mike

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

need to uncheck into preference for avoid this windows?

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

i will repare each link

Votes

Translate

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
Advisor ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

@laurence roussel12011930,

 

Give this a try to suppress the dialog window...

var topFolder = (Folder.selectDialog("Select the top level folder."))
var fileandfolderArray = scanSubFolders(topFolder,/\.(indd)$/i);

var fileList = fileandfolderArray[0];

for (var i = 0; i < fileList.length; i++) {
var myFile = fileList[i];
   
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

app.open(myFile);

while (app.documents.length > 0) { 

var doc = app.activeDocument;

doc.links.everyItem().update();

doc.close(SaveOptions.YES);

  }
}
alert("Done updating and saving files!")

 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll

function scanSubFolders(tFolder, scanMask){
    var subFolders = new Array();
    var allFiles = new Array();
    subFolders[0] = tFolder;
    for (var j = 0; j < subFolders.length; j++){    
        var procFiles = subFolders[j].getFiles();
        for (var i = 0; i< procFiles.length; i++){
            if (procFiles[i] instanceof File ){
                if(scanMask == undefined) allFiles.push(procFiles[i]);
                if (procFiles[i].fullName.search(scanMask) != -1) allFiles.push(procFiles[i]);
        }else if (procFiles[i] instanceof Folder){
            subFolders.push(procFiles[i]);
            scanSubFolders(procFiles[i], scanMask);
         }
      }
   }
   return [allFiles,subFolders];
};

Regards,

Mike

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

if a file is deleted the link is broken , i will repare it

Votes

Translate

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
Explorer ,
Oct 04, 2022 Oct 04, 2022

Copy link to clipboard

Copied

my problem is : i use batch_convert there is few day, and i don t know which error i do, but it broke me some link into my file.....

 

now your script stop each time it meet a broken link....

 

 

there is a script for list all file with broken link?

Votes

Translate

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
Explorer ,
Oct 05, 2022 Oct 05, 2022

Copy link to clipboard

Copied

i will maybe told a bull**it, but i have an error, on lot of folder, and i think this folder contain indd file with external link,and i think this files type stop your script, message is action stoped by user

Votes

Translate

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
Explorer ,
Oct 05, 2022 Oct 05, 2022

Copy link to clipboard

Copied

 line 19 save option

 

i don t understand wh the script is stoped, i have try a file with and without link, all work

Votes

Translate

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
Explorer ,
Oct 06, 2022 Oct 06, 2022

Copy link to clipboard

Copied

hi mike, i have some problem with the different script, i will resume each script and different problem, because i m really blocked into my projetc...

 

first: open all indd files, update, sav, close into folder-subfolder

2 problem

- if the files linked is missing, the script stop, and do not ast toredirect the link

-sometime without reason, the script stop on this line 19

doc.close(SaveOptions.YES);

second script for open, update link with pdf files, save, export to png

the probleme, is all files into my folder have no link inside, and that stop the script because he do not find the object for update

solution 1, add an condition if psd have no link

solution 2, only the path with one word mockup have this link

M:\infographie\Dossier Phykidis\base de donnée produit\pkd\GAMMES\yyyy\404\photo produit\mockupcreme-exploitable\1000ml\POT

M:\infographie\Dossier Phykidis\base de donnée produit\pkd\GAMMES\xxxxx\181 (SP)\photo produit\mockuptrans-exploitable\500ml\FLACON\CS

 

this word is every time at the same "level" in the path into sub folder

 

 

3 script for open to export to pdf (interactive)

since few month, my indesign crash ofter when i export in classique pdf, interactive pdf help,my problem is into my sub folder i have lot of lot of file indd, all don t need to be export to pdf, same solution the word in the path

 

all indd with the path:

M:\infographie\Dossier Phykidis\base de donnée produit\pkd\GAMMES\neutre\181 (SP)\etiquette fini\étiquettes finie.indd

 

only étiquettes finie.indd, are concerned for to be exported to pdf

 

 

 

because i need for sucess my project

first, i change 2-3 file into my folder

second, i update save close all indd files, arround 6-7 times for update all level file

exemple: file A link file B link file C

if i change C, i need top update all file 2 time for update really A

third: i export to pdf the file etiquette fini.indd

fourth: i update the pdf link into psd and export all to png (i will maybe to a variant without export)

5: i update my catalogu with all new updated file, and i export it to psd

6: i will be happy

Votes

Translate

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
Advisor ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

@laurence roussel12011930,

 

You can give this script a try to see if it works for you in the case of missing links...just note that missing links for each individual document will need to be in one folder location that you will select for the relinking.

var topFolder = (Folder.selectDialog("Select the top level folder."))
var fileandfolderArray = scanSubFolders(topFolder,/\.(indd)$/i);

var fileList = fileandfolderArray[0];

for (var i = 0; i < fileList.length; i++) {
var myFile = fileList[i];
   
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

   app.open(myFile);
}

while (app.documents.length > 0) { 

imgs = app.activeDocument.links;

for(var i = 0; i < imgs.length; i++){
  if (imgs[i].status == LinkStatus.LINK_OUT_OF_DATE){
    try{imgs[i].update();}catch(e){}
  }
   else if (imgs[i].status == LinkStatus.LINK_MISSING){
    var folderPath = (Folder.selectDialog("Select the folder with the links"))
    break;  
      }
    }
    for(var i = 0; i < imgs.length; i++){
    if (imgs[i].status == LinkStatus.LINK_MISSING){
    var imglist = Folder(folderPath).getFiles(imgs[i].name);
    
    if (imglist.length == 1){
    
    imgs[i].relink(imglist[0]);
    
        }
      }
    }

    app.activeDocument.close(SaveOptions.YES);

  }
  alert("Done updating and saving files!")

 app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll

function scanSubFolders(tFolder, scanMask){
    var subFolders = new Array();
    var allFiles = new Array();
    subFolders[0] = tFolder;
    for (var j = 0; j < subFolders.length; j++){    
        var procFiles = subFolders[j].getFiles();
        for (var i = 0; i< procFiles.length; i++){
            if (procFiles[i] instanceof File ){
                if(scanMask == undefined) allFiles.push(procFiles[i]);
                if (procFiles[i].fullName.search(scanMask) != -1) allFiles.push(procFiles[i]);
        }else if (procFiles[i] instanceof Folder){
            subFolders.push(procFiles[i]);
            scanSubFolders(procFiles[i], scanMask);
         }
      }
   }
   return [allFiles,subFolders];
};

Regards,

Mike

Votes

Translate

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
Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

hi it work, but when it ask me where is the source, i don t know wich file is it?  because i have some file with same name, if we can see the path somewhere that will help me

Votes

Translate

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
Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

it not close the file , all scanned file are open, and something is strange, look picture attached

 

it appear missing link, but file is present in right folder...

Votes

Translate

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
Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

sorry path is different...

Votes

Translate

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
Explorer ,
Oct 07, 2022 Oct 07, 2022

Copy link to clipboard

Copied

LATEST

when it ask me to relink, i can choose only a folder and not a file, there is en issu windows after relink

 

image 1 crash the script without reason error 2, user have cancel the action

Votes

Translate

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