2012-11-14 24 views
2

我正在嘗試顯示我選擇的文件的擴展名。我究竟做錯了什麼?AppleScript中的名稱擴展名不工作

set theFile to (choose file with prompt "Select a file to transfer:") 
    set ext to name extension of theFile 
    display dialog ext as text 

回答

2

嘗試:

tell application "System Events" to set ext to name extension of theFile 
1

告訴應用程序 「發現者」 集theFile選擇文件{} 組分機到theFile 顯示對話框的擴展名 「LA extenxion ES」 &分機 年底告訴

+0

一般來說,當在系統事件和查找器之間進行選擇時,系統事件會更快。另外選擇文件不需要包含在tell塊中。 – adayzdone