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

scan mask with name file and not extension

Explorer ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

hi into this function

var myFolder = Folder(defaultFolder).selectDlg("Select the folder containing InDesign Files");
//var myFolder = Folder.selectDialog("Select the folder containing InDesign Files", "");
if (!myFolder) exit();
var f = myFolder.getFiles(/\.(indd)$/i);
var doc;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
//Opens each ID file and runs the 
for (var i = 0; i < f.length; i++){
    doc = app.open(File(f[i]));
	doc.links.everyItem().update();
    OpenAndUpdate(doc);
}; 

 

 

i select a folder for scan all indd files

 

but i have so much files (1000 files),i want select only file with name "etiquette finie.indd"  (70 files)

 

 

thanks for you help

TOPICS
Scripting

Views

44

Likes

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

correct answers 1 Correct answer

Community Expert , Oct 17, 2022 Oct 17, 2022

Try the following code

function findAll (f, flist) 
{
    var f = Folder(f).getFiles("*.*");
    for (var i = 0; i < f.length; i++) 
    {
        if (f[i] instanceof Folder && f[i].name[0] != ".") 
            findAll (f[i], flist);
        else 
        {
            if(f[i].displayName == "etiquette finie.indd")
                flist.push(f[i])
        }
    }
}

var myFolder = Folder(defaultFolder).selectDlg("Select the folder containing InDesign Files");
//var myFolder = Folder.selectDialog
...

Likes

Translate

Translate
Community Expert ,
Oct 17, 2022 Oct 17, 2022

Copy link to clipboard

Copied

Hi @laurence roussel12011930,

How can a single folder contain 70 files with the same name?

-Manan

Likes

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

Copy link to clipboard

Copied

Nope it s in side different sub folder

Likes

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

Copy link to clipboard

Copied

Try the following code

function findAll (f, flist) 
{
    var f = Folder(f).getFiles("*.*");
    for (var i = 0; i < f.length; i++) 
    {
        if (f[i] instanceof Folder && f[i].name[0] != ".") 
            findAll (f[i], flist);
        else 
        {
            if(f[i].displayName == "etiquette finie.indd")
                flist.push(f[i])
        }
    }
}

var myFolder = Folder(defaultFolder).selectDlg("Select the folder containing InDesign Files");
//var myFolder = Folder.selectDialog("Select the folder containing InDesign Files", "");
if (!myFolder) exit();

var f = []
findAll(myFolder, f)
var doc;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;
//Opens each ID file and runs the 
for (var i = 0; i < f.length; i++){
    doc = app.open(File(f[i]));
	doc.links.everyItem().update();
    OpenAndUpdate(doc);
};

-Manan

Likes

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

Copy link to clipboard

Copied

LATEST

perfect

Likes

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