Copy link to clipboard
Copied
Hello Guys,
I am trying to run Script from Desktop to server it is not running well ,
Can you please help to understand this issue,
Here is the code.
My indesign server 2017
var mydoc = app.documents[0];
var theFontReplacements = [
'Minion Pro','Regular','Gotham','Light Italic',
];
for (i = 0; i < (theFontReplacements.length/100); i++) {
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.appliedFont = theFontReplacements[i*100];
if (theFontReplacements[(i*4)+1] != ''){
app.findTextPreferences.fontStyle = theFontReplacements[d(i*100)+1];
};
app.changeTextPreferences.appliedFont = theFontReplacements[(i*100)+2];
if (theFontReplacements[(i*4)+3] != ''){
app.changeTextPreferences.fontStyle = theFontReplacements[(i*100)+3];
};
mydoc.changeText();
};
and you can suggest me some idea to make run Indesign 2017 desktop javascript on Indesign server 2017 side
Thanking you,
Abhishek
Copy link to clipboard
Copied
What are you trying to do? You have the elements in the array, and you are running the loop from 0 to array length/100, i.e., 0 to 0.04. Then other calculations inside the loop.
For one comparing an integer with a float is not a great idea and should be avoided. Secondly, check if the values are set properly in the find and change objects. Also, you should make the objects null at the end of each loop/query. So put these two lines at the bottom of the loop as well
app.findTextPreferences = NothingEnum.nothing;
app.changeTextPreferences = NothingEnum.nothing;
You have used d that seems misused and undefined as well.
-Manan
Copy link to clipboard
Copied
Hello Manan,
Thank you so much for the Suggestion,
But when i run Script i get issue here
 
Thanking you,
Abhishek
Copy link to clipboard
Copied
What is the error that you get on that statement? That should work provided you have a document open. On the desktop version do you run the script by manually opening the document? If so then you need to open the document on IDS server as well. Since IDS does not have a UI, you will have to open the file using your script using the app.open method. Also once the work is done close the document using app.close()
-Manan