O'Reilly logo

AppleScript in a Nutshell by Bruce W. Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

Memory Control Panel

Dictionary commands

close

This command closes the Memory control panel, as in:

tell app "Memory" to close

count reference

Use this property to count the elements of a class:

tell app "Memory" to count available disks

This code fragment returns the number of disks the computer could use for virtual memory. count returns an integer value. See the available disk class.

each type class

You can also use the syntax:

count each available disk

This usage returns the same value as:

count available disks

use default settings

If you use the following code, the control panel will set Disk cache, virtual memory, and RAM disk to default values (e.g., the default value for a RAM disk is “off “):

tell app "Memory" to use default settings

Dictionary classes

application

This class represents the Memory control panel. It has one element, available disk, as in:

get available disks

This returns a value that looks like:

{Disk Volume "Macintosh HD" of application "Memory", Disk Volume 
"H2gig" of application "Memory", Disk Volume "HB2gig" of application "Memory",
Disk Volume "scratch" of application "Memory"}

The Memory application can also get or set various features of disk caches, virtual memory, and RAM disks. This code example finds out the state of virtual memory (active if VM is enabled on one of the local disks) and the size of VM:

tell application "Memory" set VMOn to state of virtual memory set VMsize to size of virtual memory display dialog "The state of VM ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required