-1

I'm trying to script an app that checks if in the folder i chose there is a file called file.pages, if there it is Finder should copy it for me to a set path... Is it possible I'm using there top for the existbthen commad: Applescript to check if files exist and to chose the folder i user the command: choose folder; set theFolder to result

Can anyone please script that for me? I didn't understand the copy command and how to use the POSIX

Community
  • 1
  • 1

1 Answers1

0

Try:

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
adayzdone
  • 11,120
  • 2
  • 20
  • 37