Running applescript from Matlab

6 visualizaciones (últimos 30 días)
Nicolas
Nicolas el 28 de En. de 2014
Respondida: Plem Sah el 6 de Abr. de 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!

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de En. de 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 comentario
Nicolas
Nicolas el 29 de En. de 2014
Thank you very much Walter. Works perfectly. I really appreciate your help!

Iniciar sesión para comentar.

Más respuestas (1)

Plem Sah
Plem Sah el 6 de Abr. de 2016
Very helpful thank you! I experienced the same problem.

Categorías

Más información sobre Structures en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by