私はExtendscriptスクリプト内から呼び出される必要があるpythonスクリプトを持っています。これを行うことができるライブラリ関数がありますか?私はドキュメントや他の多くのオンラインリソースの中で解決策を見つけようとしましたが、これまでのところ何も働いていませんでした。どんな助けもありがとうございます。Extendscriptの中からPythonやシェルスクリプトを呼び出す方法は?
7
A
答えて
3
this exampleをご覧ください。
スクリプトファイルの隣に.termファイルを作成して実行します。
これは洗浄バージョンである:既にファビアンによって示されるように
main();
function main() {
var script_file = File($.fileName); // get the full path of the script
var script_folder = script_file.path; // get the path from that
var new_termfile = createTermFile("execute_something", script_folder);
new_termfile.execute(); // now execute the termfile
}
/**
* creates a .term file
* @param {String} term_file_name --> the name for the .term file
* @param {Strin} path --> the path to the script file
* @return {File} the created termfile
*/
function createTermFile(term_file_name, path) {
/*
http://docstore.mik.ua/orelly/unix3/mac/ch01_03.htm
1.3.1.1. .term files
You can launch a customized Terminal window from the command line by saving some prototypical Terminal settings to a .term file,
then using the open command to launch the .term file (see "open" in Section 1.5.4, later in this chapter).
You should save the .term file someplace where you can find it later, such as ~/bin or ~/Documents.
If you save it in ~/Library/Application Support/Terminal, the .term file will show up in Terminal's File Library menu.
To create a .term file, open a new Terminal window, and then open the Inspector (File Show Info, or -I)
and set the desired attributes, such as window size, fonts, and colors. When the Terminal's attributes
have been set, save the Terminal session (File Save, or -S) to a .term file (for example, ~/Documents/proto.term).
Now, any time you want to launch a Terminal window from the command line, you can issue the following command:
*/
var termfile = new File(path + "/" + term_file_name + ".term");
termfile.open("w");
termfile.writeln(
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"" +
"\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" +
"<plist version=\"1.0\">\n" +
"<dict>\n" +
"<key>WindowSettings</key>\n" +
"<array>\n" +
" <dict>\n" +
"<key>CustomTitle</key>\n" +
"<string>My first termfile</string>\n" +
"<key>ExecutionString</key>\n" +
"<string>python\nprint \"Hello World\"\nexit()</string>\n" +
"</dict>\n" +
"</array>\n" +
"</dict>\n" +
"</plist>\n");
termfile.close();
return termfile;
};
4
ExtendScriptのファイルオブジェクトは、execute()メソッドを持っています。 私は.termファイルについて知らず、代わりに.commandファイルを使用していました。これはXMLではなく普通のシェルスクリプトです。
のInDesign内で実行されている場合は、Terminal.appをバイパスし、AppleScriptを使用することができます。
myScript = 'do shell script "diff f1 f2 > o" ';
app.doScript(myScript, ScriptLanguage.applescriptLanguage);
関連する問題
- 1. Pythonからシェルスクリプトを呼び出す
- 2. DarwinとObjectiveC - Cocoaアプリケーションからシェルスクリプトを呼び出す方法は?
- 3. Kornシェルスクリプトからoracle関数を呼び出す方法は?
- 4. Cからのシェルスクリプトを呼び出す
- 5. ハイブでシェルスクリプトを呼び出す方法
- 6. シェルスクリプトを呼び出して別のシェルスクリプトから引数を渡す方法
- 7. シェルスクリプトからJavaメソッドを呼び出す
- 8. シェルスクリプトからストアドプロシージャを呼び出す
- 9. シェルスクリプトからPython関数を呼び出す
- 10. シェルスクリプトからPythonスクリプトを呼び出すcron
- 11. UIからのシェルスクリプトの呼び出し
- 12. 他のサガの中からサガを呼び出す方法は?
- 13. ビルド中にVisual Studioからaspnet_compilerを呼び出す方法は?
- 14. クラス(Python)の__init__メソッドから変数を呼び出す方法は?
- 15. PythonからSOA Webサービスのメソッドを呼び出す方法は?
- 16. 別のシェルスクリプト内からのシェルスクリプトの呼び出しの相違
- 17. Javaスクリプトのクリックボタンでシェルスクリプトを呼び出す方法は?
- 18. Pythonからerlangを呼び出す方法は?
- 19. pythonからscalaを呼び出す方法は?
- 20. PythonでRから関数を呼び出す方法は?
- 21. Pythonでオブジェクトから関数を呼び出す方法は?
- 22. Django、JSからPythonを呼び出す方法は?
- 23. Rubyの中からC++関数を呼び出す方法
- 24. シェルスクリプトで関数を呼び出す方法は?
- 25. WindowsのpythonソースコードからJythonインタプリタを呼び出す方法
- 26. Apacheからシェルスクリプトを呼び出すには?
- 27. シェルスクリプトの呼び出しエラー:
- 28. シェルスクリプトの呼び出しエラー
- 29. シェルスクリプトの呼び出しエラー
- 30. extendscriptの.jsxファイルから実行可能ファイルを呼び出せません
はい.commandファイルが詳細.termファイルよりも道涼しいです! (知らなかった)唯一のことは実行可能にする必要があることです。 .termファイルはすぐに実行されます – fabianmoronzirfas