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..??
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.
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.
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?
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.
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]);
}
}
Copy link to clipboard
Copied
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.