O'Reilly logo

AppleScript® Programming for the Absolute Beginner by Jerry Lee Ford

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with the File Class

In order to work with a file, you need to tell AppleScript the name and location of the stored file. This is typically done by assigning the name and path of the file as a string to a variable, setting up a file reference that can then be used repeatedly throughout an AppleScript without having to respecify the file and path each time you need to refer to it. In order to set up the file reference, you need to know how to work with the file class.

Using the file class you can establish a file object reference. The syntax that you must follow when using the file class to set up a file reference is outlined here:

set FileReference to "FileNameAndPath"

FileReference is a variable that will be used to reference the file ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required