Can I set my iMac to shut down after External HD transfer complete?

Discussion in 'iMac' started by bobright, Dec 24, 2012.

  1. bobright macrumors 601

    Joined:
    Jun 29, 2010
    #1
    Ahhh got like 3 hours left im transferring from External HD to External HD and I need to leave. It isnt so Fusion so going to take a while:confused::confused::mad:
     
  2. flatfoot macrumors 65816

    Joined:
    Aug 11, 2009
    #2
    I guess it's too late for this specific occasion, but for future reference I'll post it anyway. OK, this isn't the most refined method but since the copy process gives you the estimated time remaining it's not really necessary to code the script so that it checks whether the copying is done. Furthermore, this one can be used for any occasion where you want your Mac to shut down after a specific amount of time.

    If you want your Mac to go to sleep instead, just replace "shut down" in the last line with "sleep".

    Code:
    display dialog "How many hours until desired shut-down time?" default answer "3"
    
    set shutDownTime to (get current date) + ((text returned of result) as real) * 3600
    
    repeat
    	delay 5 * 60
    	if (current date) > shutDownTime then exit repeat
    end repeat
    
    tell application "Finder" to shut down
    Copy and paste this into an AppleScript Editor window and save it wherever you want, preferably as an application.
    What it does is pretty self-explanatory, I think. :)

    You can enter a decimal number into the prompt; just make sure you don't use colons since it expects a real number, not a time span separated in hours and minutes.
     

Share This Page