Running applescript from Matlab

3 ビュー (過去 30 日間)
Nicolas
Nicolas 2014 年 1 月 28 日
回答済み: Plem Sah 2016 年 4 月 6 日
Hi all,
I have an AppleScript that takes a filepath as an input, and returns a string. In terminal, it works just fine when I run:
osascript getComment.scpt ":file:path:to:rabbit.png"
I get the expected returned value:
rabbitComment
I am now trying to run it from a Matlab function, using the system command.
[status, result] = system('osascript getComment.scpt "file:path:to:rabbit.png" ');
I get
result = dyld: DYLD_ environment variables being ignored because main executable (/usr/bin/osascript) is code signed with entitlements
rabbitComment
Status is 0, meaning no error occurred. Does anyone have any idea why this DYLD warning is raised, and how to avoid this?
Thank you very much!

採用された回答

Walter Roberson
Walter Roberson 2014 年 1 月 28 日
MATLAB extends the DYLD_LIBRARY_PATH and DYLD_FRAMEWORK_PATH environment variables that it passes into the shell, in order to add on the path to MATLAB libraries (and to Java libraries).
osascript is a program which has extended privileges ("entitlements") assigned to it.
When a program has extended privileges assigned to it, the operating system needs to ignore any shell variables about the dynamic library paths, so that a malicious user does not substitute their own library for one of the expected system libraries, thereby getting their own code executed in a privileged context.
When a program with extended privileges is executed, it gives a warning that it ignored the dynamic library variables.
The easiest workaround would be
[status, result] = system('unset DYLD_LIBRARY_PATH DYLD_FRAMEWORK_PATH; osascript getComment.scpt "file:path:to:rabbit.png" ');
  1 件のコメント
Nicolas
Nicolas 2014 年 1 月 29 日
Thank you very much Walter. Works perfectly. I really appreciate your help!

サインインしてコメントする。

その他の回答 (1 件)

Plem Sah
Plem Sah 2016 年 4 月 6 日
Very helpful thank you! I experienced the same problem.

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by