Skip to main content
Participating Frequently
February 26, 2024
Answered

スクリプトで、アートボード番号を指定して配置したいのですが可能でしょうか?

  • February 26, 2024
  • 1 reply
  • 276 views
スクリプトで、ほかのaiファイルを配置する際、アートボード番号を指定して配置したいのですが可能でしょうか?手動で、読み込みオプションからアートボードを選択する機能をスクリプトから実現したいと思っています。
This topic has been closed for replies.
Correct answer Ten A

Illustratorファイルを配置する場合はPDFを配置する事と同義ですので、以下のようにpdfOptionsのpageToOpen指定すればOKです。

 

var pref = app.preferences.PDFFileOptions;
pref.pageToOpen = 2; //set page number you want to place.
pref.pDFCropToBox = PDFBoxType.PDFMEDIABOX;
var pdfOptions = app.preferences.PDFFileOptions;
var obj = app.activeDocument.layers[0].placedItems.add();
var pdfile = File.openDialog('Select the PDF file', '*.pdf, *.ai');
var fl = new File(pdfile);
obj.file = fl;

1 reply

Ten A
Community Expert
Ten ACommunity ExpertCorrect answer
Community Expert
February 26, 2024

Illustratorファイルを配置する場合はPDFを配置する事と同義ですので、以下のようにpdfOptionsのpageToOpen指定すればOKです。

 

var pref = app.preferences.PDFFileOptions;
pref.pageToOpen = 2; //set page number you want to place.
pref.pDFCropToBox = PDFBoxType.PDFMEDIABOX;
var pdfOptions = app.preferences.PDFFileOptions;
var obj = app.activeDocument.layers[0].placedItems.add();
var pdfile = File.openDialog('Select the PDF file', '*.pdf, *.ai');
var fl = new File(pdfile);
obj.file = fl;
Participating Frequently
February 26, 2024

アクションを使うしかないかと迷走しておりました。ありがとうございました。