スクリプトを使ってカーソルの位置にアンカー枠を作成してその中に画像を挿入する例。
オブジェクトビュアーの列挙型の情報がアレなので結局FDKリファレンスを見たほうが早いという罠。
(function(){ // Insert illust filename var InsertFile = "hogehoge.jpg"; var docObj = app.ActiveDoc; if (docObj.id === 0) { Alert("select document", Constants.FF_ALERT_CONTINUE_NOTE); return; } var selObj = docObj.TextSelection; if (selObj.beg.obj.id === selObj.end.obj.id && selObj.beg.offset === selObj.end.offset) { // Add Anchored frame var aframeObj = docObj.NewAnchoredAFrame(selObj.beg); aframeObj.AnchorType = Constants.FV_ANCHOR_BELOW; aframeObj.FP_Alignment = Constants.FV_ALIGN_CENTER; // Insert illust in anchored frame var graphicObj = docObj.NewGraphicObject (Constants.FO_Inset, aframeObj); graphicObj.InsetFile = InsertFile; graphicObj.InsetDpi = 150; // Fit anchored frame aframeObj.Width = graphicObj.Width; aframeObj.Height = graphicObj.Height; } else { Alert("select text insert location", Constants.FF_ALERT_CONTINUE_NOTE); } })();
0 件のコメント:
コメントを投稿