beautypg.com

Apple AppleScript Finder Guide User Manual

Page 79

background image

C H A P T E R 2

Finder Objects

Object Class Definitions

67

COMMANDS HANDLED

Clean Up, Close, Copy, Count, Data Size, Delete, Duplicate, Exists, Get, Move,

Open, Put Away, Reveal, Select, Sort, Update

DEFAULT VALUE CLASS RETURNED

A reference to a suitcase or, if you use the plural form font suitcases, a list

of references.

EXAMPLE

The script that follows moves a font suitcase called Janson Text into or out of

the Fonts folder, first asking the user to confirm the move. (If you are using

version 1.1 of the Finder scripting software, a second dialog box appears when

the Finder is moving suitcases into the Fonts folder, warning the user that the

suitcases won’t be available to running applications right away.)

tell application "Finder"

activate
set x to name of items in fonts folder
if "Janson Text" is in x then

set response to display dialog ¬

"Remove the Janson fonts from the System?"

if button returned of response is "OK" then

move font suitcase "Janson Text" of fonts folder to ¬

folder "Font Storage" of startup disk

end if

else

set response to display dialog ¬

"Move the Janson fonts into the System?"

if button returned of response is "OK" then

move font suitcase "Janson Text" ¬

of folder "Font Storage" of startup disk to fonts folder

end if

end if

end tell