Basil.js and ExtendScript in Indesign / How can I style textFrames? -
after svg elements placed/drawn in indesign, wanna change style some or elements. in example style textframes while drawn. example works.
but how can change style after textframes placed?
i wanna use skewing angle (applied textframe) , rotationangle (look in example -> forloop)
i tried following: r.textframes.shearangle=20;
, doc.textframes.add({shearangle:20});
...but both don‘t work.
#includepath "~/documents/;%userprofile%documents"; #include "basiljs/bundle/basil.js"; // script shows how load data // basil further usage. // document working needs saved @ least once. // data needs in folder next document // folder needs named "data" // take output of js console of estk function draw() { var doc = b.doc(); b.clear(doc); // clear doc b.units(b.mm); // use mm var ytextframe = 195; // scripts name// containing folder// name of script without extension // add .indd extension var fname = file($.filename).parent.fsname + '/' + ($.filename.split('/')[$.filename.split('/').length - 1]).split('.')[0] + '.indd'; // , save doc.save(fname, false, 'basil', true); //save file next script // code goes here ----------- var filecontent = b.loadstring("data.json"); // load text file b.println(filecontent.constructor.name); // take @ kind of content have var json = b.json.decode(filecontent); // transform json b.println(json.constructor.name); // take again json b.println(json.description); // print file // loop entries (var = 0; < 5; i++) { b.println(json.laundry_care_instructions[i].instruction); // take @ entry b.println(json.laundry_care_instructions[i].instruction.length); // how many characters entry have var r =b.text(json.laundry_care_instructions[i].instruction, 10 + 7 * i, ytextframe, b.width - 20, 7).properties={rotationangle:90, shearangle:20};// create text box entry // // skewing angle applied textframe } // end of code --------- } b.go();
you got it. in code variable r
textframe object.
so should be:
r.shearangle = 20;
see tomorrow in class ;-)
edit1:
as said in comments. code
var r = b.text("txt",x,y,width, height).properties = {something:10};
returns properties
object. not textframe. remove .properties
part , benedikts , way should work.
edit2:
benedikts way not work. following error.
error: object not support property or method 'shearangle'
@benedikt: shearangle not text property. pageitems textframe, rectangle, oval , on. there way in basil.js set properties these? , how nested properties? setup new question that.
Comments
Post a Comment