function main() {
try {
app.activeDocument
} catch (error) {
alert("請至少打開一個文檔.")
return
}
var win = new Window("dialog", "我要自學(xué)網(wǎng)-嵌入鏈接文件")
win.margins = 20
var desc = win.add("panel", undefined, "說明")
var placedItemsLength = app.activeDocument.placedItems.length
if (placedItemsLength == 0) {
desc.margins = 50
desc.add("staticText", undefined, "當(dāng)前文檔暫無需要嵌入的鏈接文件")
} else {
desc.margins = 20
desc.add("staticText", undefined, "當(dāng)前文檔有 " + placedItemsLength + " 個未嵌入的鏈接文件")
desc.add("staticText", undefined, "(嵌入后, 請務(wù)必仔細(xì)核對)")
desc.add("staticText", undefined, "嵌入的時候可能會有選項, 需要手動確認(rèn)一下相關(guān)配置")
var btn = win.add("button", undefined, "執(zhí)行")
btn.onClick = function () {
var count = 0
for (var i = (placedItemsLength - 1); i >= 0; i--) {
try {
var placedItem = app.activeDocument.placedItems[i]
placedItem.embed()
count++
} catch (error) {
alert("取消嵌入")
}
}
if (count == placedItemsLength) {
alert("恭喜, 全部嵌入成功!")
} else {
alert("成功嵌入 " + count + " 個, 嵌入失敗有 " + (placedItemsLength - count) + " 個")
}
}
}
win.onClose = function () {
// alert(win.bounds.height)
// alert(win.opacity)
var winHeight = win.bounds.height
for (var i = 100; i >= 0; i = i - 4) {
win.opacity = i / 100
win.bounds.height = winHeight * i / 100
$.sleep(10)
}
}
win.show()
}
main()
承擔(dān)因您的行為而導(dǎo)致的法律責(zé)任,
本站有權(quán)保留或刪除有爭議評論。
參與本評論即表明您已經(jīng)閱讀并接受
上述條款。