In my post How to Create a RAM Disk – The Easy Way I released RamDiskCreator. As the name suggest it’s only duty is to create a RAM disk. The following AppleScript function does the same. I wrote it for Uwe to create two RAM disks at startup.
on createRamDisk(sizeInMB, volumeName) set sizeInSectors to round sizeInMB * 1024 * 1024 / 512 rounding up set cmd to "diskutil erasevolume HFS+ '" & volumeName & "' `hdiutil attach -nomount ram://" & sizeInSectors & "`" try do shell script cmd return true on error return false end try end createRamDisk
You can download the source here.