O'Reilly logo

Learn AppleScript: The Comprehensive Guide to Scripting and Automation on Mac OS X, Third Edition by Hanaan Rosenthal, Hamish Sanderson

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

Chapter 17. Working with Files

In this chapter, you will learn about the various features AppleScript uses to identify files, folders, and disks, and how to read and write files using Standard Additions.

Identifying Files, Folders, and Disks

When you work with files, you need a way to refer to them. No matter whether your goal is creating a text file, backing up some folders, or deleting the entire contents of a hard disk, the ways you refer to a file are the same.

AppleScript can identify a file, folder, or disk in four general ways, and your job is to choose the method that works best in your situation, with the application you're using:

  • An HFS or POSIX path string

  • An AppleScript object of class alias, file, or POSIX file (though there is a catch ...

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