2012-08-06 131 views
0

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

// 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。我该如何解决这个问题?

回答

0

@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( 未测试,在实测值: http://jongware.mit.edu/idcs5js/pc_Application.html)。

+0

我从下面的链接拿到剧本,它为我工作得很好...... http://forums.adobe.com/message/4603168#4603168 谢谢你的回复:)祝你有个美好的一天:) – Padmashree 2012-08-09 03:57:29

+0

@Padmashree - 啊,'BridgeTalk',我明白了。另请参阅http://kasyan.ho.com.ua/convert_cmyk-rgb_images_to_grayscale.html以获得一个很好的参考资料(尽管如此,这是针对与Photoshop进行通信的InDesign)。 – 2012-08-09 04:38:41

0

如果您正在使用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); 
相关问题