beautypg.com

Apple AppleScript Finder Guide User Manual

Page 52

background image

C H A P T E R 2

Finder Objects

40

Object Class Definitions

tell application "Finder"

set x to largest free block
set y to partition size of ¬

application file "Scriptable Text Editor" of startup disk

if x > y then

open application file "Scriptable Text Editor" of startup disk

else

display dialog ¬

"The Scriptable Text Editor prefers more memory. " & ¬
"To increase free memory, quit one or more applications."

end if

end tell

This script returns a list of all the application files in a folder:

tell application "Finder"

application files in folder "MyApps" of startup disk

end

--result: {file "Scriptable Text Editor" of folder "MyApps" of startup
disk, file "Script Editor" of folder "MyApps" of startup disk}

NOTES

The Minimum Partition Size, Partition Size, and Suggested Partition Size are all

given in bytes. These values are shown in information windows in kilobytes

(K, where 1K = 1024 bytes).
The value of the Partition Size property must be at least as high as the value of

the Minimum Partition Size property. If you set the Minimum Partition Size to

a value higher than the value of the Partition Size, the Finder also adjusts the

Partition Size to match the new Minimum Partition Size. Similarly, if you set

the Partition Size to a value lower than the value of the Minimum Partition

Size, the Finder also adjusts the Minimum Partition Size to match the new

Partition Size.
For example, suppose that the Partition Size and the Minimum Partition Size of

the Scriptable Text Editor are both set to 384K. Running this script sets the