Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Feek

macrumors 65816
Original poster
Nov 9, 2009
1,382
2,051
JO01
I thought this would be easy. I thought Amphetamine would do what I want but the triggers don't seem to work, I can't add an app trigger.

There's one app I run which, when it's running, I want to stop my Mac from sleeping. I'm quite happy for the display to blank, in fact I have a hot corner set to do that but I don't want it to sleep.

I've looked at Wimoweh but it's not clear if that'll work.

Is there an app which will do what I want please? I don't mind paying a couple of quid for it.

Thanks.
 
Wouldn’t a simple script work: get PID of app, use caffeinate to prevent sleep while the process is active.
Code:
tell application "System Events"
    set pidNumber to the unix id of process "HandBrake"
end tell
do shell script "caffeinate -i -w " & pidNumber
 
Amphetamine Preferences > General > Allow Display Sleep

Then in menu bar select “While app is running..” and select the app from the list of running apps.
 
Amphetamine Preferences > General > Allow Display Sleep

Then in menu bar select “While app is running..” and select the app from the list of running apps.
Oh that's interesting, thanks. Do I have to select the app each time or does it persist?
 
I think it wouldn't be a Preference if it was a one-time-only choice. (It would be a command, perhaps in a drop-down menu.) You're setting up the way that you prefer it to behave. It will be persistent.
 
OP:

WHICH Mac do you have?

IF it's a Mini or a Studio (or even a Mac Pro)...
... Just "reach forward" and turn off the display...!

(I realize this doesn't work for iMacs and laptops)
 
Have you tried the AppleScript from #2 ?
You can just replace HandBrake with the name of the app you want to prevent your Mac from sleeping and save the script as an app.
 
Have you tried the AppleScript from #2 ?
You can just replace HandBrake with the name of the app you want to prevent your Mac from sleeping and save the script as an app.
Yup, I have tried that. When I run it, it sits in my dock and if I right click it, it says it's not responding.
 
Yup, I have tried that. When I run it, it sits in my dock and if I right click it, it says it's not responding.
Just as Amphetamine, it's supposed to stay open to keep your Mac from sleeping. It will close itself when you close the app mentioned in the script, HandBrake in the example.
 
Just as Amphetamine, it's supposed to stay open to keep your Mac from sleeping. It will close itself when you close the app mentioned in the script, HandBrake in the example.
Ahh OK, thank you. Yes, that does seem to close after I close the app. I'll do some testing about whether it stops the Mac sleeping, thanks.

I normally launch this particular app via an Alfred workflow so it'll be easy enough to add this little AppleScript app on if it works.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.