如何使用InDesign脚本退出InDesign并打开插图?这是我的代码:
// closing the InDesign document here
myDocument.close(SaveOptions.NO);
// change the script's target to Illustrator
#target illustrator
app.documents.add(DocumentColorSpace.CMYK, width = 1024, height = 768); 但是这里的脚本并没有退出InDesign,而只是打开了Illustrator。我该如何解决这个问题?
发布于 2012-09-16 12:59:29
您必须使用BridgeTalk在Illustrator和InDesign之间进行通信。
示例:
在关闭InDesign之前,您可能应该等待Illustrator的响应,这样您就可以知道脚本已经执行完毕。
发布于 2012-08-08 13:09:56
@Padmashree --
嗯,也许InDesign以某种方式打断了你对myDocument.close ( SaveOptions.NO );的陈述?
试试这个,看看它是否有效:
// the original interaction and warning settings of the application
var oldInteractionPrefs = app.scriptPreferences.userInteractionLevel;
// prevent interaction and warnings from interrupting script
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
// close the active document without saving
app.activeDocument.close(SaveOptions.no);
// reset interactions to original settings
app.scriptPreferences.userInteractionLevel = oldInteractionPrefs;这会将应用程序的“用户交互级别”更改为"NEVER_INTERACT“,以忽略所有模式对话框窗口(错误消息、其他应用程序警报)。
我在这里找到了这个解决方案
但当然,myDocument.close ( SaveOptions.NO );本身只关闭InDesign文档,而不是程序。
app.quit(SaveOptions.NO)显然关闭了InDesign (not tested,可在:http://jongware.mit.edu/idcs5js/pc_Application.html找到)。
发布于 2013-07-10 07:30:25
如果您正在使用Win7,请尝试下一步
var mySelect = app.selection[0].graphics[0].itemLink
var myFilePath = mySelect.filePath;
var myProg = "Illustrator";
var myFile = myFilePath;
var myScript = "";
myScript += "Dim WshShell\r";
myScript += "Set WshShell = CreateObject(\"WScript.Shell\")\r";
myScript += "ReturnCode = WshShell.Run (\"\"\""+myProg+".exe\"\"\"\""+myFile+"\"\"\",1)\r";
app.doScript(myScript, ScriptLanguage.VISUAL_BASIC);https://stackoverflow.com/questions/11823615
复制相似问题