It shows you the amount of space used for every volume (partition) and also the amount of disk space used for VM. Unfortunately, the Finder does not get notified of changes in VM, but the figures are still pretty usefull, especially if you don't have enough space on your boot volume.
Copy and paste the text into the Script Editor, save it as an application, and simply drop it into either ~/Library/Scripts or /Library/Scripts. (And download the Menuscript addition.
Read the rest of the article for the script...
tell application "Finder"
set bootname to (the startup disk) as string
-- fix this if your vm is somewhere else than the default
-- eg "Volumes:swap_partition_name:vm:swapfile"
set vmspacename to ((the startup disk) as string) & ":private:var:vm:swapfile"
set myList to list disks
set outList to {}
set allFree to 0
set allSpace to 0
set outString to ""
repeat with i in myList
set diskName to (i as string)
try
set freeSpace to round (the (free space of disk diskName) / 1024 / 1024)
set totalSpace to round (the (capacity of disk diskName) / 1024 / 1024)
set allFree to allFree + freeSpace
set allSpace to allSpace + totalSpace
set outList to outList & {{diskName, freeSpace, totalSpace}}
set outString to outString & diskName & ": " & freeSpace & " MB, " & ¬
(round (100 * freeSpace / totalSpace)) & " % free" & return
end try
end repeat
set outList to outList & {{"All", allFree, allSpace}}
set outString to outString & return & "All" & ": " & allFree & " MB, " & ¬
(round (100 * allFree / allSpace)) & " % free" & return & return
repeat with i from 0 to 8
try
get the size of file (vmspacename & i)
on error
-- we fail when no swapfileX is present -> we have X files *
set vm to (i) * (the size of file (vmspacename & "0")) / (1000 * 1000)
exit repeat
end try
end repeat
set vm to (vm as string) & " MB Virtual Memory in use"
end tell
display dialog outString & vm

