当我使用Snow Leopard时,我在创建Applescripts时多次使用以下模式:
on run args
set filePath to POSIX file (item 1 of args) as alias
...
end run
Run Code Online (Sandbox Code Playgroud)
升级到Mountain Lion后,上面的脚本似乎会产生警告:
2012-08-10 15:12:12.305 osascript[54131:303]
CFURLGetFSRef was passed this URL which has no scheme
(the URL may not work with other CFURL routines): path/to/input/file.ext
Run Code Online (Sandbox Code Playgroud)
任何人都可以启发错误的含义吗?
这应该澄清问题和解决方案.所以首先要解决这个问题
TB1T-Bboot:$ cat tmp.applescript
tell application "Finder"
set MacOSpath to POSIX file "test-file" as alias
end tell
TB1T-Bboot:$ osascript tmp.applescript
2012-09-24 22:25:50.022 osascript[2564:707] CFURLGetFSRef was passed this URL which has no scheme (the URL may not work with other CFURL routines): test-file
alias TB1T-Bboot:Users:archive:test-file
TB1T-Bboot:$
Run Code Online (Sandbox Code Playgroud)
现在没有问题:
TB1T-Bboot:$ cat tmp.applescript
tell application "Finder"
set MacOSpath to POSIX file "/Users/archive/test-file" as alias
end tell
TB1T-Bboot:$ osascript tmp.applescript
alias TB1T-Bboot:Users:archive:test-file
TB1T-Bboot:$
Run Code Online (Sandbox Code Playgroud)
所以它抱怨路径是相对的,而不是绝对的.Lion中没有出现此警告.
| 归档时间: |
|
| 查看次数: |
1461 次 |
| 最近记录: |