Copy link to clipboard
Copied
HI,
I am using imac,OS: High Sierra, varsion 10.13.6, here i am open indesign file order wise its openning correctly,
but imac OS: Big Sur, version 11.3.1 here not opening correct order.
file naming:
01_FM_ind.indd.indd,
02_Intro.indd.indd,
03_A6451P_Chapter1_ind.indd,
04_A6451P_Chapter2_ind.indd,
05_A6451P_Chapter3_ind.indd,
06_A6451P_Chapter4_ind.indd,
07_A6451P_PartII_ind.indd,
08_A6451P_Chapter5_ind.indd,
09_A6451P_Chapter6_ind.indd,
10_A6451P_Chapter7_ind.indd,
11_A6451P_Chapter8_ind.indd
12_A6451P_PartIII_ind.indd,
13_A6451P_Chapter9_ind.indd,
14_A6451P_Chapter10_ind.indd,
15_A6451P_Chapter11_ind.indd,
16_A6451P_Chapter12_ind.indd,
17_BM_ind.indd
Kindly check and advise.
my code is:
myIndesignFiles = get_File(InputFolder,[],['.indd'],"FILE");
function get_File(dir,my_arr,extension_Arr,_File_Or_Folder){ //updated for copy file or folder
var f = Folder( dir ).getFiles();
for( var ifil = 0; ifil < f.length; ifil++){
var mystr=f[ifil]+"";
var aa=mystr.match(/\/[.].*/) //avoid hidden files and folders
var bb=mystr.match(/[_]VUC69~7/)
var cc=mystr.match(/DS[_]Store/)
if(f[ifil] instanceof Folder){
// no need go to sub folder
//~ if((aa==null) && (cc==null)){
//~ if(_File_Or_Folder == 'FOLDER'){
//~ my_arr.push(f[ifil]);
//~ }
//~
//~ get_File( f[ifil],my_arr,extension_Arr,_File_Or_Folder)
//~ }
}
else if(_File_Or_Folder == 'FILE'){
if(aa==null && bb==null && cc==null){
if(extension_Arr[0]=='.*'){
my_arr.push(f[ifil])
}
else{
for(var a=0;a<extension_Arr.length;a++){
if( f[ifil].name.substr( -extension_Arr[a].length ) == extension_Arr[a] ){
my_arr.push(f[ifil])
}
}
}
}
}
}//for
return my_arr; //my_arr - is file or folder
}
M Srikanth
Copy link to clipboard
Copied
The problem seems to be the order of the files returned by the getFiles method. Seems that it is different on both the OS and incidently one of them is according to your needs. You need to sort the array elements as per your need explicitly. Looking at your filenames probably my_arr.sort() before returning it would suffice.
P.S. :- I don't see any code to open the InDesign files so my advice is based on the presumtion that you are looping over the array you create and then opening the file corresponding to each entry.
-Manan