A.10. Chapter 10
A.10.1. Exercise 1 solution
-- Sliding windows tell application "Finder" set newWin to make new Finder window repeat with i from 1 to 200 set position of newWin to ({i * 4, 800 - i * 4} as point) end repeat close newWin end tell
A.10.2. Exercise 2 solution
On my system, I get the following for the file reference:
folder "steve" of folder "Users" of startup disk of application "Finder" tell application "Finder" tell startup disk tell folder "Users" set fileRef to get folder "steve" end tell end tell end tell
fileRef as string
POSIX path of (fileRef as string)
fileRef as alias
A.10.3. Exercise 3 solution
tell application "Finder" to get size of file toDoFIleT
tell application "Finder" to duplicate file toDoFIle to (path to documents folder)
tell application "Finder" to set name of file toDoFIle to "ToDoOld.txt"
tell application "Finder" to delete file toDoFIle
or
tell application "Finder" to move file toDoFIle to trash
tell application "Finder" make new folder at home with properties {name: "ToDoFolder"} move file toDoFile to home end tell
tell application "Finder" to count (files of home whose name begins with "ToDo")
tell application "Finder" to count (files of home whose name contins "ToDo")
A.10.4. Exercise 4 solution
-- Create an Internet location file tell application "Finder" make new internet location file at desktop to "p2p.wrox.com" end tell
A.10.5. Exercise 5 solution
-- Get an email for someone in the Address Book display dialog "Enter first name:" ...
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.