JMP 15 AppleScript Run Program()Run Program()を使用したことがないので、助けが必要です。JMPはパスワードで保護されたExcelファイルを開くことができないため、小さなApplescriptを開いてそれらを開き、保護されていない.csvとしてエクスポートします。このApplescriptをJSLスクリプト内から実行したいと思います。多分それがうまく機能すれば、それをラップする小さなJMPユーザー関数を作成するので、パスワードで保護されたExcelを開く機能をJMPでシミュレートできます。
しかし... Run Program()の問題を抱えています。いくつかの質問。
1。Applescriptをアプリケーション(拡張子.app)またはスクリプト(拡張子.scpt)として保存する必要があります。
2。私のJSL構文は次のようになります。
Run Program( Executable( "Users/me/Desktop/myscript.scpt" ) )
ただし、次のエラーが発生して機能しません。
launch path not accessible in access or evaluation of 'Glue' , Names Default To Here( 1 ); /*###*/Run Program(
Executable( "/Users/me/Desktop/re.scpt" )
) /*###*/;
In the following script, error marked by /*###*/
Names Default To Here( 1 ); /*###*/Run Program(
Executable( "/Users/me/Desktop/re.scpt" )
) /*###*/;
繰り返しますが、.appと.scptを使用してみましたが、拡張子はまったく使用しませんでした。
明らかに、結果の.csvエクスポートファイルのハンドルを取得するためにいくつかの追加コードを追加する必要がありますが、今のところは、ベアボーンApplescriptを実行するだけで十分です。
助けてくれてありがとう。
Re:JMP 15 AppleScript Run Program()こんにちはしゅう 、
スクリプトを.appとして保存し、次のようなものを使用してそのアプリケーションを開きます。このアプリケーションは、「open」実行可能ファイルを使用して.appを開きます。
Run Program(
Executable( "/usr/bin/open"),
options( {"/users/me/Desktop/myscript.app"} )
);
これがあなたが始めるのに役立つことを願っています!
@julian
Re:JMP 15 AppleScript Run Program()パーフェクト!!ありがとう!!!Re:JMP 15 AppleScript Run Program()これについて少しだけフォローアップすると、一部のMacユーザーが役に立つかもしれません。
Applescriptのアイデアはうまくいきませんでした-JSLのせいではなく、OSX 10.15でのMSExcelアップルスクリプトの制限のためです。(Excelの保存コマンドは、サンドボックス化のせいで正しく機能しなくなりました。MicrosoftはApplescriptサポートを更新する必要があると言われています。)
代わりに、非常に優れたOSXスクリプト/マクロアプリであるKeyboard Maestro(KM)を使用して、必要なものをスクリプト化することにしました。(強くお勧めします-利益相反はありません。)
KMで必要なスクリプトを書きました。次に、KMスクリプトを呼び出す小さなJSL関数を作成しました。
Add Custom Functions(
New Custom Function(
"ex",
"Run KMScript",
Function( {scriptID, paramlist = {}},
{paramstring},
paramstring = Concat Items( paramlist );
Run Program(
Executable( "/usr/bin/osascript" ),
Options(
"-e tell application \!"Keyboard Maestro Engine\!" to do script \!"" || scriptID || "\!" with parameter \!"" || paramstring ||
"\!""
)
);
)
) << Prototype( "ex:Run KMScript( scriptID as string, < {param1 as string, param2 as string, etc.} > )" ) << Parameter( "String", "scriptID" ) <<
Parameter( "List", "parameter(s)" ) << Formula Category( "Utility" ) << Description(
"Runs a Keyboard Maestro script. The KM scriptID is a UUID; you can reveal and copy it by opening the 'Or trigger by shell script' text box at the top of your KM macro window. The (optional) parameters to the KM script can be retrieved inside the KM macro using the KM '%TriggerValue' token. KM receives them as a single concatenated string of space-separated values."
)
);現在、JSL内でこれを使用して、保護されているExcelファイルをNumbersで開き、保護を解除し、csvとして保存し、JMPで開き、Numbersを閉じるKMマクロを呼び出しています。正常に動作します。
他の誰かがこれを役に立つと思うかもしれません。
Re:JMP 15 AppleScript Run Program()これは素晴らしい、ジョン!あなたがこれを共有してくれてうれしいです、私はそれが誰かに役立つと確信しています。
@julian Re:JMP 15 AppleScript Run Program()ありがとう、ジュリアン。
わずかに改善されたバージョンを次に示します。KMスクリプトの最後のアクションとしてKMの「システムクリップボードをテキストに設定...」アクションを含めることで、KMマクロから値を返すことができます。JSL関数は、関数の戻り値としてクリップボードの内容を使用します。
また、KMマクロのUUIDを使用する必要がないこともわかりました。KMマクロのプレーンバニラ名を使用するだけでも同様に機能します。
Add Custom Functions(
New Custom Function(
"ex",
"Run KMScript",
Function( {scriptID, paramlist = {}},
{paramstring, savedClipboard, macroResult = ""},
paramstring = Concat Items( paramlist );
savedClipboard = Get Clipboard();
Run Program(
Executable( "/usr/bin/osascript" ),
Options(
"-e tell application \!"Keyboard Maestro Engine\!" to do script \!"" || scriptID || "\!" with parameter \!"" || paramstring ||
"\!""
)
);
macroResult = Get Clipboard();
Set Clipboard( savedClipboard );
Return( macroResult );
)
) << Prototype( "ex:Run KMScript( scriptID as string, < {param1 as string, param2 as string, etc.} > )" ) << Parameter( "String", "scriptID" )
<< Parameter( "List", "parameter(s)" ) << Formula Category( "Utility" ) << Description(
"Runs a Keyboard Maestro (KM) script. The KM scriptID is either the KM macro's name or UUID. (You can reveal and copy the UUID by opening the 'Or trigger by shell script' text box at the top of your KM macro window.) The (optional) parameters to the KM script can be retrieved inside the KM macro using the KM '%TriggerValue%' token. KM receives them as a single concatenated string of space-separated values. If you want to return a value from KM, push it to the system clipboard before exiting the macro. This function will grab the clipboard contents and use as the function return value. (The function saves and restores the pre-invocation clipboard state, so the system clipboard is unaffected by the function.)"
)
);