FrameMaker 10とExtendedScriptのセミナーがAdobe eSeminarであったみたいです。
その時のサンプルデータとスライドが下のブログに上がっています。 http://frameautomation.com/2011/05/31/framemaker-10-extendscript-slides/
オブジェクトチェックにObjectValid()というメソッドがあったのか。
あと、イベント処理とかもいけるのか。
FrameMaker 10とExtendedScriptのセミナーがAdobe eSeminarであったみたいです。
その時のサンプルデータとスライドが下のブログに上がっています。 http://frameautomation.com/2011/05/31/framemaker-10-extendscript-slides/
オブジェクトチェックにObjectValid()というメソッドがあったのか。
あと、イベント処理とかもいけるのか。
スクリプトを使ってカーソルの位置にアンカー枠を作成してその中に画像を挿入する例。
オブジェクトビュアーの列挙型の情報がアレなので結局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); } })();
var mMenu = app.GetNamedMenu("!MakerMainMenu"); var nMenu = mMenu.DefineAndAddMenu("APIMenu", "TextApi"); nMenu.DefineAndAddCommand(1, "GetTextCmd", "Get Text",""); nMenu.DefineAndAddCommand(2, "AddTextCmd","Insert Text","\\!GT"); nMenu.DefineAndAddCommand(3, "DeleteTextCmd", "Delete Text", "\\!IT"); nMenu.DefineAndAddCommand(4, "ColorTextCmd", "Color Text", "\\!DT"); nMenu.DefineAndAddCommand(5, "FontSizeCmd", "Change Font Size", "\\!CT"); UpdateMenus(); function Command(command) { var doc = app.ActiveDoc; if(doc.id === 0) Alert("Please selected Document.", Constants.FF_ALERT_CONTINUE_WARN); switch(command) { /* Get text from selection. */ case 1: var tr = doc.TextSelection; if (tr.beg.obj.id === 0 || ((tr.beg.obj.id === tr.end.obj.id) && (tr.beg.offset === tr.end.offset))) { Alert("Please select some text and try again.", Constants.FF_ALERT_CONTINUE_WARN); break; } var textItems = doc.GetTextForRange(tr, Constants.FTI_String); alert(CreateStringFromTextItems(textItems)); break; /* Add text. */ case 2: var tr = doc.TextSelection; if (tr.beg.obj.id === 0) { Alert("Please select an insertion point and try again.", Constants.FF_ALERT_CONTINUE_WARN); break; } if (!((tr.beg.obj.id === tr.end.obj.id) && (tr.beg.offset === tr.end.offset))) { if (Alert("Do you wish to overwrite the selected text?", Constants.FF_ALERT_NO_DEFAULT)) break; } doc.AddText(tr.beg, "The new CoffeeTool\011"); break; /* Delete selected text. */ case 3: var tr = doc.TextSelection; if (tr.beg.obj.id === 0 || ((tr.beg.obj.id === tr.end.obj.id) && (tr.beg.offset === tr.end.offset))) { Alert("Please select some text and try again.", Constants.FF_ALERT_CONTINUE_WARN); break; } doc.DeleteText(tr); break; /* Change the color of selected text to Red. */ case 4: var tr = doc.TextSelection; if (tr.beg.obj.id === 0 || ((tr.beg.obj.id === tr.end.obj.id) && (tr.beg.offset === tr.end.offset))) { Alert("Please select some text and try again.", Constants.FF_ALERT_CONTINUE_WARN); break; } var color = doc.GetNamedObject(Constants.FO_Color, "Red"); // Color name is different in each language. var props = doc.GetTextProps(tr.beg); var i = GetPropIndex(props, Constants.FP_Color); props[i].propVal.obj = color; doc.SetTextProps(tr, props); break; /* Change the font size of the selected text to 30 points. */ case 5: var tr = doc.TextSelection; if (tr.beg.obj.id === 0 || ((tr.beg.obj.id === tr.end.obj.id) && (tr.beg.offset === tr.end.offset))) { Alert("Please select some text and try again.", Constants.FF_ALERT_CONTINUE_WARN); break; } /* Allocate memory for the property list. */ props = AllocatePropVals(1); /* Set up the properties. */ props[0].propIdent.num = Constants.FP_FontSize; props[0].propVal.ival = 30 * 65536; props[0].propVal.valType = Constants.FT_Metric; /* Apply the property list to the text selection. */ doc.SetTextProps(tr, props); break; } } /*************************************************************** * Create a string from an TextItems structure. ****************************************************************/ function CreateStringFromTextItems(textItems) { var s = ""; for (var i = 0; i < textItems.length; i++) { if (textItems[i].dataType === Constants.FTI_String) { s += textItems[i].sdata; } } return s; }
FrameMaker 10の発表、そして出荷が始まったらしい。
昨年末に動画で登場していたときにはすでにマスターアップが完了していたということなのだろう。
アップグレード内容はS1000、DITA1.2対応、それに関連する機能の強化が主なんだろう。市販のCMS(SharePoint、Documentum)に対応といったところだ。
早速、体験版を入れてあれこれ触ってみて目についた新しい機能は
下は10分位で適当に作ったスクリプトです。選択した画像のアンカー枠の大きさを選択した画像の大きさに合わせるスクリプトです。
var docObj = app.ActiveDoc;
var selGfx = docObj.FirstSelectedGraphicInDoc;
var afrmObj = selGfx.FrameParent;
afrmObj.Width = selGfx.Width;
afrmObj.Height = selGfx.Height;
selGfx.LocX = 0;
selGfx.LocY = 0;
問題はバージョンアップできるのが8からということか。(TCS3だと7.xからできるが本体より高い)
まだ世の中で動いているシステムの大半が7.x以下ではないだろうか。