VBScript

FilemakerとInDesignでプチ自動組版(名刺作成)

プチ自動組版なので __∧ノ_ (゚д゚) ゚( )− / > てな感じで始めます。よろしくお願いします。_(._.)_ まず、出来なかった事から先に書いておきます。 出来れば設定いらずで運用できるようにしたかったのですが、外部アプリからVBSを実行させるとカレントディレク…

単位の変更

[JavaScript] var myDoc = app.activeDocument; //定規の水平方向 myDoc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS; //定規の垂直方向 myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS; …

選択したフレームにスクリプトラベルを設定する

[JavaScript] var frame = app.activeDocument.selection[0]; frame.label = "画像枠";[VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.label = "画像枠"※参考 スクリプトラベルが設定されて…

フレームの移動

1.ドキュメントの座標値で移動 (配列で [横座標 , 縦座標] ) [JavaScript] var frame = app.activeDocument.selection[0]; frame.move ([10,10]);[VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(…

オーバーフローしたテキストを長体で押し込む

[JavaScript] var frame = app.activeDocument.selection[0]; try{ while(frame.overflows){ frame.parentStory.horizontalScale = frame.parentStory.horizontalScale - 1; } }catch(e){ frame.parentStory.horizontalScale = 100; alert("長体かけまくりま…

テキストフレームのオーバーフロー(溢れ)値を取得する

[JavaScript] var frame = app.activeDocument.selection[0]; alert(frame.overflows);[VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) msgbox frame.overflowsオーバーフローしている場合 True オ…

グラフィックス化(アウトライン化)

[JavaScript] var frame = app.activeDocument.selection[0]; frame.createOutlines();[VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.createOutlines()※注意 アンダーラインとか使っている…

Glyph(グリフ)検索置換

[JavaScript] app.changeGlyphPreferences = NothingEnum.nothing; app.findGlyphPreferences = NothingEnum.nothing;app.findGlyphPreferences.appliedFont = app.fonts.item("A-OTF 新ゴ Pro M"); app.findGlyphPreferences.glyphID = 7565; app.changeGly…

テキストフレームのフィットオプション

テキストに合せてフレームが行方向に伸び縮みします。[JavaScript] var frame = app.activeDocument.selection[0]; frame.fit(FitOptions.FRAME_TO_CONTENT);[VBScript] Set app = CreateObject("InDesign.Application") Const idFrameToContent = 171890672…

画像フレームのフィットオプション

画像をフレームピッタリに配置したり、逆に画像に合せてフレームを大きくしたり小さくしたり。[JavaScript] var frame = app.activeDocument.selection[0]; frame.place(File("/c/sample.jpg")); frame.fit(FitOptions.CONTENT_TO_FRAME); [VBScript] Set ap…

画像フレームの揃え(フレーム調整オプション、基準点)の変更

[JavaScript] var frame = app.activeDocument.selection[0]; frame.frameFittingOptions.fittingAlignment = AnchorPoint.TOP_CENTER_ANCHOR; frame.place(File("/c/sample.jpg")); [VBScript] Set app = CreateObject("InDesign.Application") Const idBot…

フレーム全体の行揃えを変更する

[JavaScript] var frame = app.activeDocument.selection[0]; frame.parentStory.justification = Justification.rightAlign; [VBScript] Set app = CreateObject("InDesign.Application") Const idRightAlign = 1919379572 Set frame = app.activeDocument.…

フレーム全体の行送りを変更する

[JavaScript] var frame = app.activeDocument.selection[0]; frame.parentStory.leading = 30; [VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.parentStory.leading = 30

フレーム削除

[JavaScript] var frame = app.activeDocument.selection[0]; frame.remove(); [VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.delete()

スクリプトラベルが設定されているフレームを選択する

[JavaScript] var myDoc = app.activeDocument; frame = myDoc.pages.item(0).pageItems.item("画像枠"); [VBScript] Set app = CreateObject("InDesign.Application") Set myDoc = app.ActiveDocument Set frame = myDoc.pages.item(1).pageItems.item("画…

EPS形式で保存

[JavaScript] var myDoc = app.activeDocument; myDoc.exportFile(ExportFormat.EPS_TYPE, File("/c/sample.eps")); [VBScript] Set app = CreateObject("InDesign.Application") Const idEPSType = 1952400720 Set myDoc = app.ActiveDocument myDoc.Export…

テキスト検索置換

[JavaScript] app.changeTextPreferences = NothingEnum.nothing; app.findTextPreferences = NothingEnum.nothing; app.findTextPreferences.findWhat = "これを"; app.changeTextPreferences.changeTo = "アレニ"; app.changeTextPreferences.appliedFont …

ファイル保存

[JavaScript] var myDoc = app.activeDocument; myDoc = myDoc.save(File("/c/sample.indd")); [VBScript] Set app = CreateObject("InDesign.Application") Set myDoc = app.ActiveDocument myDoc.save("C:/sample.indd") 保存しないで閉じる場合は [JavaSc…

フレームサイズの取得

[JavaScript] var frame = app.activeDocument.selection[0]; var y = frame.visibleBounds[0]; //左上 y var x = frame.visibleBounds[1]; //左上 x var y1 = frame.visibleBounds[2]; //右下 y1 var x1 = frame.visibleBounds[3]; //右下 x1 [VBScript] Se…

フレームサイズの変更

[JavaScript] var frame = app.activeDocument.selection[0]; frame.visibleBounds = ["10","10","100","100"]; [VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.visibleBounds = Array(10,1…

画像フレームの作成

[JavaScript] frame = myDoc.textFrames.add(); frame.contentType = ContentType.GRAPHIC_TYPE; [VBScript] Set app = CreateObject("InDesign.Application") Const idGraphicType = 1735553140 Set myDoc = app.ActiveDocument Set frame = myDoc.textFram…

テキストフレームの作成

[JavaScript] var myDoc = app.activeDocument; frame = myDoc.textFrames.add(); [VBScript] Set app = CreateObject("InDesign.Application") Set myDoc = app.ActiveDocument Set frame = myDoc.textFrames.add()

ドキュメントサイズの変更

[JavaScript] var myDoc = app.activeDocument; myDoc.documentPreferences.pageWidth = "150mm"; myDoc.documentPreferences.pageHeight = "150mm"; [VBScript] Set app = CreateObject("InDesign.Application") Set myDoc = app.ActiveDocument myDoc.docu…

新規ドキュメント作成

[JavaScript] myDoc = app.documents.add(); [VBScript] Set app = CreateObject("InDesign.Application.CS3_J") Set myDoc = app.Documents.add()

ファイルを開く

[JavaScript] myDoc = app.open(File("/c/sample.indt")); [VBScript] Set app = CreateObject("InDesign.Application.CS3_J") Set myDoc = app.Open("C:/sample.indt")

画像フレームに画像を張り込む

[JavaScript] var frame = app.activeDocument.selection[0]; frame.place(File("/c/sample.eps")); [VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.place("C:/sample.eps") ※参考 画像フレ…

テキストフレームに文字を設定する

[JavaScript] var frame = app.activeDocument.selection[0]; frame.contents = "こんにちは世界"; [VBScript] Set app = CreateObject("InDesign.Application") Set frame = app.activeDocument.selection(1) frame.contents = "こんにちは世界" ※注意(設…

PDF/X-1aでPDF出力

[JavaScript] var myPDFExportPreset = app.pdfExportPresets.item("[PDFX1a 2001 JPN]"); var myDoc = app.activeDocument; myDoc.exportFile(ExportFormat.pdfType, File("/c/sample.pdf"),false,myPDFExportPreset); [VBScript] Set app = CreateObject("…

Grep検索置換

[JavaScript] app.changeGrepPreferences = NothingEnum.nothing; app.findGrepPreferences = NothingEnum.nothing; app.findGrepPreferences.findWhat = "<太字>([^<]*)</太字>"; app.changeGrepPreferences.changeTo = "$1"; app.changeGrepPreferences.appliedFo…

テキストフレーム内の段落数を取得

[JavaScript] var frame = app.activeDocument.selection[0]; //ストーリーの段落数 alert(frame.parentStory.paragraphs.length); //オーバーフロー、フレーム連結は含まない alert(frame.paragraphs.length); [VBScript] Set app = CreateObject("InDesign…