Highlighted

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

Explorer ,
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
Adobe Community Professional
Correct answer by Peter_Kahrel | Adobe Community Professional

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.

Topics

How to, Scripting

Views

600

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

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

Explorer ,
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
Adobe Community Professional
Correct answer by Peter_Kahrel | Adobe Community Professional

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.

Topics

How to, Scripting

Views

601

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
Mar 25, 2020 0
Adobe Community Professional ,
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.

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
Reply
Loading...
Mar 25, 2020 0
Explorer ,
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

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
Reply
Loading...
Mar 25, 2020 0
Adobe Community Professional ,
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.

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
Reply
Loading...
Mar 26, 2020 0
Explorer ,
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

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
Reply
Loading...
Mar 26, 2020 0
Adobe Community Professional ,
Mar 26, 2020

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.

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
Reply
Loading...
Mar 26, 2020 3