Reply To: Paragraph Style conversion

#114601
Tamás Nagy
Participant

Anyway, here’s the translated script, use it, if you wish! :)
I will try to put the whole between ‘code’ tags, I hope it will work. If not, the tag is of course not part of the script. :D


var myInputfiles=[];
var myDoc, myStyleDoc;

var myInitPath="~/Desktop/";
if (File.fs == "Windows") myInitPath="C:/";

myGetStyleFile();
myGetfolderfiles();

for (var i=0; i<myInputfiles.length; i++) {
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
myDoc=app.open(myInputfiles[i],true,OpenOptions.OPEN_ORIGINAL);
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
myDoc.importStyles(ImportFormat.TEXT_STYLES_FORMAT,myStyleDoc,GlobalClashResolutionStrategy.LOAD_ALL_WITH_OVERWRITE);
myDoc.close(SaveOptions.YES);
};

function myGetfolderfiles(){
var myPath=new File(myInitPath);
myInputfiles=myPath.openDlg("Select all documents to refresh text styles in!",undefined,true);
if (myInputfiles==null) {alert("You didn't choose any docs, script terminates.","Error"); exit() };
};

function myGetStyleFile(){
var myPath=new File(myInitPath);
myStyleDoc=myPath.openDlg("Select the document to be the source of text styles!",undefined,false);
if (myStyleDoc==null) {alert("You didn't choose a source doc, script terminates.","Error"); exit() };
};

This article was last modified on February 22, 2019

Comments (0)

Loading comments...