Skip to content

Instantly share code, notes, and snippets.

@Quasimo
Created November 17, 2012 07:44
Show Gist options
  • Select an option

  • Save Quasimo/4094086 to your computer and use it in GitHub Desktop.

Select an option

Save Quasimo/4094086 to your computer and use it in GitHub Desktop.

Revisions

  1. Quasimo created this gist Nov 17, 2012.
    31 changes: 31 additions & 0 deletions gistfile1.applescript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,31 @@
    -- 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%"