Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: Help! Need to change all endnote numbers to roman numerals quick and easy.

$
0
0

Hi,

 

try this:

 

 

var myDoc = app.activeDocument;    app.findGrepPreferences = null;    app.findGrepPreferences.findWhat = "\\d+";    app.findGrepPreferences.position = Position.SUPERSCRIPT;     var myFound = myDoc.findGrep();    var l = myFound.length;    while(l--)        myFound[l].contents = arabic2roman(myFound[l].contents); 
function arabic2roman (arab)    {    var roman = ''    if (arab < 4000)        {        var rom = [];        rom[0] = ["","i","ii","iii","iv","v","vi","vii","viii","ix"];        rom[1] = ["","x","xx","xxx","il","l","lx","lxx","lxxx","xc"];        rom[2] = ["","c","cc","ccc","cd","d","dc","dcc","dccc","cm"];        rom[3] = ["","m","mm","mmm","4m","5m","6m","7m","8m","9m"];        arab = arab.toString().split("").reverse().join("");        for (var i = 0; i < arab.length; i++)            roman = rom[i][arab.charAt(i)] + roman;        }    return roman    }

this function is pasted from some Peter Kahrel's script

 

Be awared: script will change all (whole active doc) superscripted digits into roman.

Limited to numbers less then 4000

 

rgds


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>