7.7. Summary

This chapter taught you how to work with files in AppleScript. In particular, you learned the following:

  • A path name describes the location of a file or folder on your system.

  • You can create a file object by placing a file specifier in front of a traditional path name or a POSIX file specifier in front of a POSIX path name.

  • An alias to a file allows you to create a reference to a file that continues to track the file even if it gets renamed or moved to some other place.

  • AppleScript has several built-in commands that allow you to work easily with files. These commands are in the Standards Additions dictionary. Using them you can create, write data to, and read data from files. The commands open for access, read, write, and close access are the basic commands for performing these I/O operations.

  • Other Standard Addition commands allow you to list the contents of a folder or the disks you have mounted and enable the user to choose a file, a folder, or a file name.

In the next chapter, you learn to use AppleScript handlers, which let you to develop your programs in a modular fashion for easier writing, reading, and maintenance. Before proceeding, however, try the exercises that follow to test your understanding of the material covered in this chapter. You can find the solutions to these exercises in Appendix A.

Get Beginning AppleScript® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.