if (app.selection.length == 1){
if(app.selection[0].constructor.name == "Word" ||
app.selection[0].constructor.name == "Text" ){
txt = app.selection[0];
if(txt.length > 2){
do_script(txt);
} else {
alert("3文字以上の欧文単語を選択してください");
}
} else {
alert("3文字以上の欧文単語を選択してください");
}
} else {
alert("3文字以上の欧文単語を選択してください");
}
function do_script(txt){
const sepchr = "\x03" /* =1396855379=idEndNestedStyle=先頭文字スタイルの終了文字*/
var stindex = txt.index;
var str1 = txt.contents;
str1 = str1.replace(/0/g, sepchr+"0"+sepchr).replace(/1/g, sepchr+"1"+sepchr);
str1 = str1.replace(/2/g, sepchr+"2"+sepchr).replace(/3/g, sepchr+"3"+sepchr);
str1 = str1.replace(/4/g, sepchr+"4"+sepchr).replace(/5/g, sepchr+"5"+sepchr);
str1 = str1.replace(/6/g, sepchr+"6"+sepchr).replace(/7/g, sepchr+"7"+sepchr);
str1 = str1.replace(/8/g, sepchr+"8"+sepchr).replace(/9/g, sepchr+"9"+sepchr);
str1 = str1.replace(/\./g, sepchr+"."+sepchr);
str1 = str1.split(sepchr+sepchr).join("");
str1 = str1.split(sepchr+"."+sepchr).join("\.");
if (str1.charAt(0) == sepchr) str1 = str1.substr(1);
if (str1.charAt(str1.length-1) == sepchr) str1 = str1.substr(0, str1.length-1);
txt.contents = str1;
var txn = txt.parentStory.characters.itemByRange(stindex, str1.length+stindex-1);
txn.tatechuyoko = true;
for (i=0; i < txn.length; i++){
if (txn.characters[i].contents == 1396855379){
txn.characters[i].tatechuyoko = false;
}
}
}
|