Using a try block to move files

This code uses a “try” block when moving a file. On an error it will display a dialog to the user. Pulled from the AppleScript Users list.

 try
  move aFile to folder destFolder
 on error -- oops, couldn't move the file
  display dialog ("Couldn't move " & name of aFile as string) buttons {"OK"}
 end try
1 Like