var fileList = app.document.selections;
for(var i=0; i<fileList.length; i++){
myBTalk(fileList[i].path);
}
function myBTalk(filename){
var scriptcode = 'var fPath = "'+filename+'";';
scriptcode += 'var imgObj = app.layoutWindows[0].activePage.textFrames.add();';
scriptcode += 'imgObj.contentType = ContentType.graphicType;';
scriptcode += 'imgObj.place(new File(fPath));';
scriptcode += 'imgObj.fit(FitOptions.frameToContent);';
//$.writeln(scriptcode);
var btObj = new BridgeTalk;
btObj.body = scriptcode;
btObj.target = "indesign-5";
btObj.send();
}
var ext = [".jpg", ".png", ".gif"]; // 拡張子
var fileList = app.document.selections;
for(var i=0; i<fileList.length; i++){
for(var j=0; j<ext.length; j++){
if (fileList[i].path.indexOf(ext[j]) > -1){
myBTalk(fileList[i].path);
}
}
}
function myBTalk(filename){
var scriptcode = 'var fPath = "'+filename+'";';
scriptcode += 'var imgObj = app.layoutWindows[0].activePage.textFrames.add();';
scriptcode += 'imgObj.contentType = ContentType.graphicType;';
scriptcode += 'imgObj.place(new File(fPath));';
scriptcode += 'imgObj.fit(FitOptions.frameToContent);';
//$.writeln(scriptcode);
var btObj = new BridgeTalk;
btObj.body = scriptcode;
btObj.target = "indesign-5";
btObj.send();
}