本文介绍了Applescript、POSIX 文件名和 Mountain Lion的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我使用 Snow Leopard 时,我在创建我的 Applescript 时多次使用以下模式:
While I was using Snow Leopard, I've used many times the following pattern when creating my Applescripts:
on run args
set filePath to POSIX file (item 1 of args) as alias
...
end run
升级到 Mountain Lion 后,上面的脚本似乎产生了警告:
After upgrading to Mountain Lion, the above script seems to produce a warning, though:
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
谁能解释错误的含义?
推荐答案
这应该澄清问题和解决方案.所以首先问题
This should clarify the problem and solution. So first with the problem
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:$
现在没有问题了:
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:$
所以它抱怨路径是相对的,而不是绝对的.Lion 中不会出现此警告.
So it's complaining that the path is relative, not absolute. This warning doesn't come up in Lion.
这篇关于Applescript、POSIX 文件名和 Mountain Lion的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!