0

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 を開くだけです。どうすればこれを解決できますか?

4

4 に答える 4

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にあります)。

于 2012-08-08T05:09:55.657 に答える
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);
于 2013-07-09T23:30:25.227 に答える