我的Applescript和Python脚本位于当前工作目录中。 现在我需要使用shell命令调用名为test.py的Python脚本和来自applescript的管理员权限。从Applescript调用Python脚本
这段代码在AppleScript的给
tell application "Finder" to get folder of (path to me) as Unicode text
set presentDir to POSIX path of result
这段代码在AppleScript的调用从一个AppleScript的Python脚本手动
do shell script "/Users/mymac/Documents/'Microsoft User Data'/test.py"
如何将presentDir添加到该命令沿着PWD具有管理员权限?
编辑和更新:
set py to "test.py "
set calldir to workingDir & py
do shell script calldir
它给出了一个错误
error "sh: /Users/mymac/Documents/Microsoft: No such file or directory" number 127
但 显示对话框calldir 显示
/Users/mymac/Documents/Microsoft User Data/test.py
原因:
由于空间原因,它在shell脚本命令中的'Microsoft'之后被分解。
因为test.py位于presentDir的同一目录中,我怎样才能忽略shell中”/ users/mymac/Documents /'Microsoft用户数据'/ test.py“的用法脚本命令。 – thinkcool
林不知道我理解你的问题,但我用我最好的猜测编辑你的意思? – agf
我已更新问题.. – thinkcool