Applescript检查文件夹是否为true

时间:2012-01-22 22:27:11

标签: applescript

在下面的脚本中,我试图通过检查确定输入的路径是否指向文件夹:

folder of file_info -> should return true/false

但是在尝试这个时,脚本会给出错误并停止。

但其他值也很好用:

size of file_info -> return size incase of folder its "missing value"

有人知道为什么这个有效吗?我见过人们使用它的其他脚本,但似乎没有人得到这个错误

on log_event(themessage)
            set theLine to (do shell script "date  +'%Y-%m-%d %H:%M:%S'" as string) & " " & themessage
            do shell script "echo " & theLine & " >> ~/Library/Logs/tvshowscript-events-test.log"
        end log_event

        tell application "Finder"

            set str to "Macintosh HD:Users:"

            set the_item to str as alias

            set file_info to get info for the_item

            my log_event("-------------- " & size of the file_info)
            my log_event("-------------- " & kind of the file_info)
            my log_event("-------------- " & folder of the file_info)   

        end tell

1 个答案:

答案 0 :(得分:0)

尝试删除行tell application "Finder"end tell