Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #target "InDesign"
- function getSelectedTf(){
- var sels = app.activeDocument.selection;
- //テキストフレーム以外を除外
- for(var i=sels.length-1;i>-1;i--){
- if(sels[i].constructor.name!=='TextFrame'){
- sels.splice(i,1);
- }
- }
- // 先頭のTFを取得
- var tf = sels[0];
- return tf;
- }
- function appendText( tf , text ){
- var mytf = app.activeDocument.textFrames.add();
- mytf.contents = text + "\r";
- // set pstyle
- //var ps = doc.paragraphStyles.item("$styleName");
- //mytf.texts.item(0).applyParagraphStyle(ps, true);
- tf.nextTextFrame = mytf;
- mytf.remove();
- }
- var tf = getSelectedTf();
- appendText( tf, "hello!" );
Add Comment
Please, Sign In to add comment