Matlab 自动编辑SystemVersion.plist

Matlab 自动编辑SystemVersion.plist,matlab,applescript,osx-yosemite,osx-yosemite-beta,Matlab,Applescript,Osx Yosemite,Osx Yosemite Beta,我目前正在使用OSX10.10,需要使用MATLAB;然而,由于他们还没有更新应用程序以支持10.10,它将在启动时崩溃 到目前为止,我一直在使用pico编辑SystemVersion.plist[1](将版本从10.10更改为10.9);这非常有效,除了每次需要打开MATLAB时编辑文件,每次关闭MATLAB时重新编辑文件非常烦人 我想做的是,当我启动脚本时,它会将SystemVersion.plist编辑为正确的版本,这样我就可以运行MATLAB而不会崩溃;然后,当MATLAB退出时,它会将

我目前正在使用OSX10.10,需要使用MATLAB;然而,由于他们还没有更新应用程序以支持10.10,它将在启动时崩溃

到目前为止,我一直在使用pico编辑SystemVersion.plist[1](将版本从10.10更改为10.9);这非常有效,除了每次需要打开MATLAB时编辑文件,每次关闭MATLAB时重新编辑文件非常烦人

我想做的是,当我启动脚本时,它会将SystemVersion.plist编辑为正确的版本,这样我就可以运行MATLAB而不会崩溃;然后,当MATLAB退出时,它会将版本从10.9重置回10.10)。我有一些代码(可能写得不好;我以前从未使用过applescript)


[1] -

我采用了相同的方法,但最终得出了这个解决方案:(适用于os x yosemite和matlab r2014a)

该对话框是必需的。延迟(以秒为单位)由于任何原因都不起作用(我第一次使用applescript解决matlab问题)。可能还有另一个解决方案,但这对我来说很有效

如果您正在使用mac with retina display,则可能需要安装java 7运行时环境,并用以下内容替换do shell脚本部分:


do shell script "export MATLAB_JAVA=\"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home\"" & "; export MATLAB_USE_USERWORK=1" & ";/Applications/MATLAB_R2014a.app/bin/matlab -desktop &> /dev/null &"
图标看起来还是有点糟糕,但是字体不再模糊了

我希望这可以帮助最近更新到约塞米蒂后面临问题的任何人


jens

这非常有效,但是,我发现我需要更改SystemVersion.plist的文件权限,以便脚本访问它。您使用的是哪个文件权限(我目前使用的是776-rwxrw-;但这有点不安全)我已经添加了我的用户,以便在SystemVersion.plist上具有读写权限。也可能不是最好的解决方案,但就目前而言,在MathWorks拿出解决方案之前,我不知道该怎么做。有什么建议吗?
tell application "System Events"
    set plistFile to property list file "/System/Library/CoreServices/SystemVersion.plist"
    tell plistFile
        get property list item "ProductVersion"
        set value of property list item "ProductVersion" to "10.90"
    end tell
end tell

do shell script "export MATLAB_USE_USERWORK=1" & ";/Applications/MATLAB_R2014a.app/bin/matlab -desktop &> /dev/null &"

display dialog "..." buttons {"Ok"} with icon note giving up after 10

tell application "System Events"
    set plistFile to property list file "/System/Library/CoreServices/SystemVersion.plist"
    tell plistFile
        get property list item "ProductVersion"
        set value of property list item "ProductVersion" to "10.10"
    end tell
end tell

do shell script "export MATLAB_JAVA=\"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home\"" & "; export MATLAB_USE_USERWORK=1" & ";/Applications/MATLAB_R2014a.app/bin/matlab -desktop &> /dev/null &"