CHAPTER 1
Introduction to Finder Scripting
12 Writing Scripts That Control the Finder
Listing 1-3 shows another script that uses the Display Dialog command. This
script automates a couple of tasks that network administrators often have to
perform: adding a new user and adding a drop folder for that user.
Listing 1-3 A script that adds a new user to the Users & Groups control panel and
adds a drop folder for that user to the startup disk
tell application "Finder"
set dialogResult to display dialog ¬
"Name of new user:" default answer ""
set newUser to text returned of dialogResult
set cPanel to control panel "Users & Groups" of ¬
control panels folder
open cPanel
make user at cPanel with properties {name:newUser}
set newFolder to make folder at startup disk ¬
with properties {name:newUser}
set owner of newFolder to newUser
set group of newFolder to "Department Group"
set see folders of group privileges of newFolder to true
set see files of group privileges of newFolder to true
set make changes of group privileges of newFolder to true
set see folders of owner privileges of newFolder to true
set see files of owner privileges of newFolder to true
set make changes of owner privileges of newFolder to true
set see folders of guest privileges of newFolder to false
set see files of guest privileges of newFolder to false
set make changes of guest privileges of newFolder to true
end tell
Comments to this Manuals