我有包含圖像的 indesign 文件,如何在桌面上複製原始圖像並重新連結到文件中的副本?我在腳本中嘗試此程式碼(但他不複製該文件):
if(app.documents.length != 0){
if((app.documents.item(0).allGraphics.length != 0)&&(app.selection.length != 0)){
//A production version of this script would probably include
//a more complete list of graphic/page item types.
switch(app.selection[0].constructor.name){
//If a frame is selected with the Selection tool...
case "Rectangle":
case "Oval":
case "Polygon":
if(app.selection[0].graphics.length != 0){
myDisplayDialog(app.selection[0].graphics.item(0));
}
break;
//If a graphic is selected with the Direct Selection tool...
case "Image":
case "EPS":
case "PDF":
myDisplayDialog(app.selection[0]);
break;
}
}
}
function myDisplayDialog(myGraphic){
//A production version of this script would probably check the link
//status before proceeding to get the link file.
var myLink = myGraphic.itemLink;
var myLinkName = myLink.name;
var myLinkFile = File(myLink.filePath);
//A production version of this script would check to see if
//the link file is present, and whether it's an alias/shortcut
//rather than a file.
var myDialog = app.dialogs.add({name:"Rinomina immagine"});
with(myDialog.dialogColumns.add()){
with(dialogRows.add()){
with(dialogColumns.add()){
staticTexts.add({staticLabel:"Nome file:"});
}
with(dialogColumns.add()){
var myFileNameField = textEditboxes.add({editContents:myLinkName, minWidth:200});
}
}
}
var myResult = myDialog.show();
if(myResult == true){
var myFileName = myFileNameField.editContents;
myDialog.destroy();
myRenameGraphic(myLink, myLinkFile, myFileName);
}
else{
myDialog.destroy();
}
}
function myRenameGraphic(myLink, myLinkFile, myFileName){
//A production version of the script would put up an error if the
//file cannot be renamed (for whatever reason).
myLinkFile.rename(myFileName);
myLink.relink(myLinkFile);
myLink.update();
}
答案1
您問題中的腳本會重新命名連結的圖像,並使用此新名稱重新連結該圖像。有時它非常方便。但我不明白你的問題。
您的 INDD 中有嵌入/貼上的圖像嗎?您需要將圖像保存在 HDD 上並將其作為普通連結圖像放回 INDD 中嗎?還有另一個腳本:
https://creativepro.com/files/kahrel/indesign/unembed_images.html