JMP 15 AppleScript 실행 프로그램()Run Program()을 사용해 본 적이 없어서 도움이 필요합니다. JMP는 암호로 보호된 Excel 파일을 열 수 없기 때문에 약간의 Applescript를 사용하여 파일을 열고 보호되지 않은 .csv로 내보냅니다. JSL 스크립트 내에서 이 Applescript를 실행하고 싶습니다. 잘 작동한다면 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 실행 프로그램()고마워, 줄리안.
다음은 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.)"
)
);Re: JMP 15 AppleScript 실행 프로그램()환상적이야, 존! 공유해 주셔서 감사합니다. 누군가에게 도움이 될 것이라고 확신합니다.
@줄리안Re: JMP 15 AppleScript 실행 프로그램()이것에 대한 약간의 후속 조치로 일부 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 내에서 사용하여 Numbers에서 보호된 Excel 파일을 열고, 보호를 해제하고, csv로 저장하고, JMP에서 연 다음, Numbers를 닫는 KM 매크로를 호출하고 있습니다. 잘 작동합니다.
다른 사람이 이것을 유용하게 사용할 수 있기를 바랍니다.
Re: JMP 15 AppleScript 실행 프로그램()완벽한!! 감사해요!!!Re: JMP 15 AppleScript 실행 프로그램()안녕 @john_madden ,
스크립트를 .app로 저장한 다음 다음과 같은 것을 사용하여 해당 응용 프로그램을 엽니다. 이 응용 프로그램은 'open' 실행 파일을 사용하여 .app을 엽니다.
Run Program(
Executable( "/usr/bin/open"),
options( {"/users/me/Desktop/myscript.app"} )
);
시작하는 데 도움이 되었기를 바랍니다.
@줄리안