beautypg.com

Apple AppleScript Finder Guide User Manual

Page 88

background image

C H A P T E R 2

Finder Objects

76

Object Class Definitions

property Extras : false

tell application "Finder"

if (exists item " Add Extras" of apple menu items folder) ¬

= false and ¬
(exists item " Remove Extras" of apple menu items folder) ¬

= false then

make alias file with data (file "Toggle Apple Menu Extras" of ¬

startup disk) at apple menu items folder ¬
with properties {name:" Add Extras"}

end if

if Extras is false then

move contents of folder "Apple Menu Extras" of startup disk to ¬

apple menu items folder

set the name of item " Add Extras" in apple menu items folder ¬

to " Remove Extras"

set Extras to true

else

move (every item of apple menu items folder ¬

whose name begins with "@") to ¬
folder "Apple Menu Extras" of startup disk

set the name of item " Remove Extras" in ¬

apple menu items folder to " Add Extras"

set Extras to false

end if

end tell

The script begins by declaring the value of the Extras property to be false.

This value may change after the script is run.
If the script hasn’t been run before, the first If statement in the script creates an

alias file of the script application in the Apple Menu Items folder with the name

Add Extras. This alias file appears in the Apple menu along with all the other