Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Great news! Plus an ApleScript way!!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Great news! Plus an ApleScript way!!
Authored by: dashard on May 31, '02 04:23:35PM
I took the hints from 'zpincus' and modified them to AppleScript.
Here's what I came up with (you may have to reformat the script from the copy/paste).
tell application "Finder"
activate
display dialog "This script will create a RAM Disk on your desktop.
How many megabytes would you like it to be?" default answer "" buttons {"OK", "Cancel"} default button 1
set diskSize to (text returned of the result)
set diskSize to diskSize * 2048
do shell script "hdid -nomount ram://" & diskSize
set dskImg to the result

set prevTextDelims to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"/"}
set myDevDisk to the last text item of dskImg
log result
set myShellCmd to "/sbin/newfs_hfs /dev/r" & myDevDisk as text
do shell script myShellCmd
display dialog result
do shell script "hdiutil mount /dev/" & myDevDisk
set AppleScript's text item delimiters to prevTextDelims
end tell

Hope it works for you.
For those of you who may have been getting an error at the 'new_hfs'... part, I added the full path to the command, as mine was giving me an error.

Please also note that you will very likely have to unmount the disk from the Disk Utility. It disappeared fine from my desktop with the drag-to-trash method, but didn't really go away. FWIW.

Feel free to email me with questions.
Enjoy.

[ Reply to This | # ]