javascript - Find text content by char style -
i'm starting indesign (cs5) scripting.
i try content (text) char style. made little script, it's work when diplay in alert content, not when try write txt file. have idea ??
var mydoc = app.activedocument; var mytextfile = file ("c:/users/julien/documents/catalogues/mapping/test.txt"); mytextfile.open ("w"); products = new array; var tosearch = "mystyle" ; app.findtextpreferences = null app.changetextpreferences = null; app.findtextpreferences.appliedcharacterstyle = tosearch; var myfound = mydoc.findtext (); (i = 0; <myfound.length; i++){ mytextfile.write (myfound[i].contents); alert(myfound[i].contents); mytextfile.write ("\n"); } mytextfile.close ();
and last not list, try find on page data come from, exept selected page, didn't find how page number "found text".
many thanks
i did "trick" adding
mytextfile.encoding = 'utf-8'
just before open file !!!
Comments
Post a Comment