Macos AppleScript:如果文件存在,则复制到路径

Macos AppleScript:如果文件存在,则复制到路径,macos,copy,applescript,paste,Macos,Copy,Applescript,Paste,我正在尝试编写一个应用程序脚本,检查我选择的文件夹中是否有一个名为file.pages的文件,如果有,Finder应将其复制到设置的路径。。。有没有可能我正在使用there top作为existb当commad:和选择文件夹时,我使用命令:choose folder;抵消结果 谁能帮我写下剧本吗?我不了解copy命令以及如何使用POSIX,请尝试: set fileName to "file.pages" set myFolder_alias to choose folder try

我正在尝试编写一个应用程序脚本,检查我选择的文件夹中是否有一个名为file.pages的文件,如果有,Finder应将其复制到设置的路径。。。有没有可能我正在使用there top作为existb当commad:和选择文件夹时,我使用命令:choose folder;抵消结果

谁能帮我写下剧本吗?我不了解copy命令以及如何使用POSIX,请尝试:

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