Okay, so I have no programming knowledge whatsoever. I took Visual Basic as a freshman in High School many years ago, and that is the limit of my experience. I had a problem with a Device Removal error that I would get every time my Mac went to sleep. Realized it was my external Hard Drive still being connected. So I came up with a very basic script to eject the drive before my Mac went to sleep. Here's the code: =============================================== on idle tell application "System Events" if exists (process "ScreenSaverEngine") then delay 180 tell application "Finder" to eject "Bamboo" else return 90 end if end tell tell application "System Events" sleep end tell end idle -- Bamboo is the name assigned to the external drive. ============================================ Functions perfectly in order to always eject the drive before my Mac goes to sleep. the PROBLEM: If I come back while the screen saver is running and before the Mac sleeps, it does not interrupt the process, and my comp still sleeps at the end of the delay timer. Is there an efficient way to add in another check before the system sleeps? So that if I manage to catch my computer just on screensaver it won't automatically go to sleep. As a side note, if there is a command I can use to make this script run automatically on startup, or am I required to launch the script from a folder every time I reboot? Keep in mind my limited programming knowledge, so I may not understand a lot of acronyms or jargon. Any help is appreciated. Thanks in advance. P.S. If anyone knows of a more efficient script or code to achieve this same effect, feel free to post. However, I am not looking for a third-party program or background app.