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 ...

Get AppleScript in a Nutshell 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.