beautypg.com

Modifying recorded scripts 1 – Apple AppleScript Finder Guide User Manual

Page 18

background image

C H A P T E R 1

Introduction to Finder Scripting

6

Recording Actions in the Finder

Listing 1-1

A sample recorded script

tell application "Finder"

activate
close every window
select startup disk
open selection
set position of window of startup disk to {4, 43}
set size of window of startup disk to {369, 464}
select folder "Financial" of startup disk
open selection
set position of window of folder "Financial" of startup disk to ¬

{378, 43}

set size of window of folder "Financial" of startup disk to ¬

{200, 155}

select folder "Letters" of startup disk
open selection
set size of window of folder "Letters" of startup disk to ¬

{257, 385}

set position of window of folder "Letters" of startup disk to ¬

{379, 222}

set size of window of folder "Letters" of startup disk to ¬

{200, 286}

end tell

Modifying Recorded Scripts

1

You can often modify a recorded script to suit new circumstances. For example,

you could adapt the script shown in Listing 1-1 for use with an external hard

disk rather than the startup disk by changing the term startup disk to disk

"nameOfDisk" throughout the script, where nameOfDisk is the name of the hard

disk on which the folders Financial and Letters are located.
Or suppose you want to make sure the Finder opens each window specified in

Listing 1-1 with a specific view selected in the Views menu. One way to do this

might be to place the insertion point after the last line of the script in the script