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

js code to java code

Engaged ,
Feb 05, 2019 Feb 05, 2019

Copy link to clipboard

Copied

Hi,

 

Could any one convert my js code into java code?

 

Thanks in advance!!!

var ePubFontFolder = Folder("~/Desktop/myEpub");
var myFontFolder = Folder("~/Font_Collection");
show_dialog ();
alert("Done!");
function copy_fonts (ePubFontFolder) {
var myFontList = ePubFontFolder.getFiles();
for(var i=0; i<myFontList.length; i++) {
var myFont = myFontList;
if(myFont instanceof File && myFont.hidden != true && myFont.name.match(/\.([ot]tf|dfont)/g)) {
var myFontName = myFont.name.replace(/\.([ot]tf|dfont)/g, ".otf");
var myFontFile = File(myFontFolder + "/" + myFontName.split(/[-.]/g)[0] + "/" + myFontName);
if(myFontFile.exists){
myFont.remove();
myFontFile.copy (Folder(myFont.parent + "/" + myFontName));
} else {
alert(myFont + ":\r Not found...");
}
} else if (myFont instanceof Folder){
copy_fonts (myFont);
}
}
}

 

Regards,

Sumit

-Sumit
TOPICS
Scripting

Views

484

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 , Feb 05, 2019 Feb 05, 2019

Hi Sumit,

The code pretty much remains the same, the main part is making JAVA talk to InDesign application. On Windows you would need a library that can load COM objects for you and then you can translate your code, that would be pretty straightforward. Have a look at the following discussion to get a start

Manipulate Indesign cliente from a Java Application

-Manan

Votes

Translate

Translate
Community Expert ,
Feb 05, 2019 Feb 05, 2019

Copy link to clipboard

Copied

LATEST

Hi Sumit,

The code pretty much remains the same, the main part is making JAVA talk to InDesign application. On Windows you would need a library that can load COM objects for you and then you can translate your code, that would be pretty straightforward. Have a look at the following discussion to get a start

Manipulate Indesign cliente from a Java Application

-Manan

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