Last active
April 15, 2023 06:15
-
-
Save monokano/8c683e46533c061eb3aca6e03b0a0113 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//################################################################# | |
// リンク更新を解決.jsx | |
// | |
// InDesignのオブジェクトレイヤーオプション > リンク更新オプションを | |
// 「applicationSettings」に設定し、反映する。 | |
// | |
// 選択範囲内のリンクが処理対象 | |
//################################################################# | |
if(app.documents.length === 0) {exit();} | |
var objs = app.selection; | |
var objCount = objs.length | |
for(var i=0; i<objCount; i++) { | |
if (objs[i].constructor.name === "PDF" || objs[i].constructor.name === "Image") { | |
updateLinkOption(objs[i]); | |
}else{ | |
var gfxs = objs[i].allGraphics; | |
var gfxCount = gfxs.length | |
for(var g=0; g<gfxCount; g++) { | |
updateLinkOption(gfxs[g]); | |
} | |
} | |
} | |
function updateLinkOption(obj) { | |
try { | |
if (obj.itemLink.status === LinkStatus.LINK_EMBEDDED) {return;} | |
var parentItem = obj.parent; | |
var linkFile = File(obj.itemLink.filePath); | |
obj.graphicLayerOptions.updateLinkOption = UpdateLinkOptions.applicationSettings; | |
parentItem.graphics[0].itemLink.relink(linkFile); | |
} catch (e) {alert("オブジェクトレイヤーオプションに非対応\n" + obj.itemLink.name)}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment