Example of using a "try" statement 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.

OS version:

 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