首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用InDesign脚本退出InDesign并打开插图?

如何使用InDesign脚本退出InDesign并打开插图?
EN

Stack Overflow用户
提问于 2012-08-06 14:45:08
回答 5查看 1.5K关注 0票数 0

如何使用InDesign脚本退出InDesign并打开插图?这是我的代码:

代码语言:javascript
复制
// 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。我该如何解决这个问题?

EN

回答 5

Stack Overflow用户

发布于 2012-09-16 12:59:29

您必须使用BridgeTalk在Illustrator和InDesign之间进行通信。

示例:

  • http://forums.adobe.com/thread/287542
  • http://ajarproductions.com/blog/2008/12/14/easy-and-readable-extendscript-to-jsfl-workflow/
  • http://selfdocumentingcode.blogspot.com/2009/05/using-adobe-bridgetalk-synchronously.html

在关闭InDesign之前,您可能应该等待Illustrator的响应,这样您就可以知道脚本已经执行完毕。

票数 1
EN

Stack Overflow用户

发布于 2012-08-08 13:09:56

@Padmashree --

嗯,也许InDesign以某种方式打断了你对myDocument.close ( SaveOptions.NO );的陈述?

试试这个,看看它是否有效:

代码语言:javascript
复制
 // 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找到)。

票数 0
EN

Stack Overflow用户

发布于 2013-07-10 07:30:25

如果您正在使用Win7,请尝试下一步

代码语言:javascript
复制
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);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11823615

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档