2012-10-16 52 views
-1

我想腳本的應用程序,檢查是否在我選擇的文件夾中有一個名爲file.pages的文件,如果它是Finder應該將它複製到一個集合路徑...是否有可能我在那裏使用存在頂部commad:Applescript to check if files exist並選擇文件夾我用戶的命令:選擇文件夾;設置文件夾結果AppleScript:如果文件existthen然後複製到路徑

任何人都可以請腳本,爲我?我不明白的複製命令,以及如何使用POSIX

回答

0

嘗試:

set fileName to "file.pages" 

set myFolder_alias to choose folder 
try 
    tell application "Finder" to set myFile to (first file of myFolder_alias whose name is fileName) 
on error 
    return fileName & " does not exist in " & myFolder_alias 
end try 

set myAlias to myFile as alias 
set myHFS_Path to myAlias as text 
set myPosixPath to POSIX path of myAlias