Skip to content

Instantly share code, notes, and snippets.

@Quasimo
Created November 17, 2012 07:44
Show Gist options
  • Save Quasimo/4094086 to your computer and use it in GitHub Desktop.
Save Quasimo/4094086 to your computer and use it in GitHub Desktop.
-- Created By AudialRedux (c) 2011
-- v1.0
tell application "Finder"
set diskName to (name of startup disk)
set diskSpace to (free space of startup disk)
--(*Number of bytes free.*)
set diskSpace to (round (diskSpace * 1048576))
(*Changes bytes into megabytes.*)
set diskCap to (capacity of startup disk)
--(*Number of bytes that the disk can hold.*)
set diskCap to (round (diskCap / 1048576))
set Cushion to (round (0.2 * diskCap))
--(*20% of the disk.*)
set diskSpace to (diskSpace - Cushion)
--(*Amount of space left in disk.*)
set CurDate to ((current date) as string)
end tell
set status to display dialog "On: " & CurDate & return & "The drive: " & diskName & return & "Has :" & diskSpace & "MBs available." buttons {"Ok Thanks!", "Free Ram!."} with title "Free Ram v1.0 By AudialRedux 2011" default button "Free Ram!." with icon note
if button returned of status = "Free Ram!." then
do shell script "purge ram"
do shell script "purge"
delay 1.0
tell application "Dock"
quit
launch
end tell
end if
display dialog "Ram Freeing Completed! 100%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment