Running applescript from Matlab

3 Ansichten (letzte 30 Tage)
Nicolas
Nicolas am 28 Jan. 2014
Beantwortet: Plem Sah am 6 Apr. 2016
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!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 28 Jan. 2014
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 Kommentar
Nicolas
Nicolas am 29 Jan. 2014
Thank you very much Walter. Works perfectly. I really appreciate your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Plem Sah
Plem Sah am 6 Apr. 2016
Very helpful thank you! I experienced the same problem.

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by