AppleScript的,POSIX文件名和美洲狮 [英] Applescript, POSIX filenames and Mountain Lion

查看:167
本文介绍了AppleScript的,POSIX文件名和美洲狮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用雪豹,我创建我的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

升级到山狮后,上面的脚本似乎产生警告,虽然:

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

任何人都可以对错误的意思指教?

Could anyone enlighten on the meaning of the error?

推荐答案

这应该澄清的问题和解决方案。因此,首先的的问题

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:$

因此​​,它的抱怨,路径是相对的,不是绝对的。此警告不上来的狮子。

So it's complaining that the path is relative, not absolute. This warning doesn't come up in Lion.

这篇关于AppleScript的,POSIX文件名和美洲狮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆