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

How to open the indesign document in sorted form using script???

Participant ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

Hi, I have 20 INDD document placed in a specific folder. While selecting any one of the InDesign document using the script we must have the INDD document order of descending.Please guide on this..??

-Monisha
TOPICS
How to , Scripting

Views

872

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 , Mar 26, 2020 Mar 26, 2020

Replace this line:

var inddFiles = allFiles.sort ();

with this:

var inddFiles = allFiles.sort (function (a, b) {return a.name < b.name});

And next time please come to the point straight away.

Votes

Translate

Translate
Community Expert ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

Simply use the standard openDialog:

indd = File.openDialog ('Select InDesign files', 'INDD:*.indd', false);

The user can sort the list in the usual platform-specific way.

P.

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
Participant ,
Mar 25, 2020 Mar 25, 2020

Copy link to clipboard

Copied

Hi,

 

I need to display all the indesign documents in descending order using radio button control. Can you please guide me?

-Monisha

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 ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

Why do you have to use a radio button. What's wrong with openDialog()?  Or do you aleady have an interface to which you want to add something? If you're not going to be more explicit, don't expect any answers.

 

P.

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
Participant ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

I have a script to view the documents placed in a specific folder. In that we have to sort the document in descending order?? Hereby I have attached the script for your reference..

 

var myDocument = app.documents.firstItem();
var docName = myDocument.name;
if(myDocument.saved == true)
{
var myDoc = app.documents.firstItem();
// alert(myDoc)
var myFolderName = '';
var myDocumentName = app.activeDocument.name;
var docName = myDocumentName.replace(".indd","");
var modifiedDate =docName.modified;
var myPathName = myDoc.filePath.fullName + '/' + docName;
var f = Folder(myPathName );
var allFiles = f.getFiles("*.indd",false);
alert (allFiles)
var inddFiles = allFiles.sort ();
alert (inddFiles)
if(allFiles.length == 0)
{
alert("No files found matching "+myDocumentName);
}
else
{
var fileDialog = app.dialogs.add({name:"Restore Versions"});
{
with(fileDialog)
{
with(dialogColumns.add())
{
with(fileSel = radiobuttonGroups.add())
{
for(var i=0;i<inddFiles.length;i++)
{
// allFiles[i].sort ();
var array = new Array ()
var sampleFiles= array.sort(allFiles)
alert (array)
alert (sampleFiles)
radiobuttonControls.add({staticLabel:allFiles[i].name,checkedState:i==0});
}
}
}
}
}
}
}
if(fileDialog.show() == true)
{
app.activeDocument = app.open(inddFiles[fileSel.selectedButton]);
}
}

 

 

 

 

-Monisha

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 ,
Mar 26, 2020 Mar 26, 2020

Copy link to clipboard

Copied

LATEST

Replace this line:

var inddFiles = allFiles.sort ();

with this:

var inddFiles = allFiles.sort (function (a, b) {return a.name < b.name});

And next time please come to the point straight away.

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