1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Adobe MediaEncoderをExtendScriptから終了する

Last updated at Posted at 2013-12-25

JSXファイルの関連づけでExtendScriptを実行したとき,次のコードではAMEを終了できません。ExtendScript Toolkitから実行する場合は関係ありません。
正確にはapp.quit()が実行されたのを見計らってマウスポインタを動かす,キーストロークを送るなどでようやく終了します。

ame_quit3.jsx
# target 'estoolkit-4.0'
var target = 'ame-7.0';
var bt = new BridgeTalk;
bt.target = target;
bt.body = function(){
    $.sleep(500);
    app.quit();
}.toSource() + "()";
bt.send(30);

次のコードも終了できません。
このコードではAMEのscheduleTask(script,msec,repeat)メソッドを使い,スクリプトを予約実行させています。

ame_quit4.jsx
# target 'estoolkit-4.0'
var target = 'ame-7.0';
var bt = new BridgeTalk;
bt.target = target;
bt.body = function(){
    app.scheduleTask('app.quit()',500,false);
}.toSource() + "()";
bt.send(30);

scheduleTaskがうまくいっていないわけではありません。
例えば下記のコードは正常に実行できます。

ame_quit5.jsx
# target 'estoolkit-4.0'
var target = 'ame-7.0';
var bt = new BridgeTalk;
bt.target = target;
bt.body = function(){
    app.scheduleTask("alert('Good bye.');app.quit()",500,false);
}.toSource() + "()";
bt.send(30);

Solution

次に示すように,一旦別のアプリケーションをアクティブにしてやると終了できます。

quitAME.jsx
# target 'estoolkit-4.0'
var bt = new BridgeTalk();
bt.target = 'ame-7.0';
bt.body = function(){
	app.quit();
	BridgeTalk.bringToFront('estoolkit-4.0');
	BridgeTalk.bringToFront('ame-7.0');
}.toSource()+"()";
bt.send(5);
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?