![見出し画像](https://assets.st-note.com/production/uploads/images/53840519/rectangle_large_type_2_fee8b467c6819c09f14262da3209d709.png?width=1200)
スクリプトファイルを実行する Keyboard Maestro 用アクション | Illustrator
macOS版のIllustratorでは,次の種類のスクリプトファイルを実行できます。
• ExtendScript(JavaScript/拡張子:js, jsx, jsxbin)
• AppleScript(拡張子:scpt, scptd, app, applescript)
• JXA(JavaScript for Automation/拡張子:scpt, scptd, app, applescript)
Keyboard Maestroでスクリプトを実行するには,それぞれ別のアクションを呼び出す必要があります。例えばAppleScriptはExecute an AppleScript,JXAはExecute a JavaScript For Automationです。
しかし,単にスクリプトを実行するだけでそこまでの使い分けが要るのはハードルが高く感じますよね。
そこで今回は,種類を気にせずスクリプトファイルを実行できるKeyboard Maestro用アクションを紹介します。
あらまし
![画像6](https://assets.st-note.com/production/uploads/images/18842434/picture_pc_50e6d5b6a1c1dfb2dab4936fe03cae29.png?width=1200)
スクリプトファイルのパスを渡すと,拡張子js/jsx/jsxbinのExtendScript,scpt/scptd/app/applescriptのAppleScript・JXAファイルをIllustratorで実行するアクションです。Script pathは,Finderから対象のファイルをドロップすれば自動で入力されます。
Keyboard Maestroから引数としてテキストを渡し,スクリプト側でそれを受け取れます。Argumentsに用がないときは,空白でも何か文字を入れても問題ありません。
ExtendScriptの引数(※開発者向け情報)
Argumentsはargumentsまたは$.getenv('sttk3_arguments')で受け取ります。
// ExtendScript 1
var argv = arguments[0];
alert(argv.toString());
// ExtendScript 2
var argv = $.getenv('sttk3_arguments');
alert(argv.toString());
AppleScript・JXAの引数(※開発者向け情報)
Argumentsはrunハンドラの引数として受け取ります。
-- AppleScript
on run (argv)
display dialog argv
end run
// JXA
function run(argv) {
const stdApp = Application.currentApplication() ;
stdApp.includeStandardAdditions = true ;
stdApp.displayDialog(argv) ;
}
動作環境・インストール方法はそれぞれリンク先をご確認ください。macOSとKeyboard Maestroを使用中のかたのみご利用できます。
使いかた
Illustratorを開いた状態でアクションを実行してください。指定したスクリプトが実行されます。
ダウンロード
このアクションは無料なので,下のリンクからどうぞ。
ここから先は
![](https://assets.st-note.com/production/uploads/images/6562021/profile_c2ece714596fbc6c60ddb2e0e7fb5746.jpg?fit=bounds&format=jpeg&quality=85&width=330)
MaestroPack
前面にあるAdobeアプリケーションで,スクリプトやアクション・整列などを実行するKeyboard Maestro用追加アクションのセット…
Amazonギフトカード5,000円分が当たる
この記事が気に入ったらチップで応援してみませんか?