Jump to content

gandalfsaxe

Member
  • Posts

    103
  • Joined

  • Last visited

Everything posted by gandalfsaxe

  1. Hi, Sorry for the late reply. The solution I ended up with involved just making a keyboard shortcut for toggling "Do Not Disturb" and thus turn off system notifications form chat programs. Sometimes I close the chat programs (Goofy, Telegram) instead to keep mail notifications if I'm having an important conversation. Seems like a fine solution, I don't need "Self-Control" anymore
  2. Hello, I'm working on a workflow to reduce distractions for a set amount of time. I've been trying to extend this very simple script: http://johnback.us/blog/2013/07/02/instantly-remove-all-distractions-with-applescript/ The purpose of above script is to simply close specified applications and run the application SelfControl for 60 minutes. The first problem: To generalize this to any amount of minutes allowed by SelfControl, I have in Alfred created a keyword with required argument separated by space and having it run the action "Run NSAppleScript", simply substituting 60 by q: tell application "System Events" tell process "SelfControl" tell slider of window "SelfControl" to set value to q click button "Start" of window "SelfControl" end tell end tell This seemingly does not work. I have tried twice with two different numbers (I think 15 and 60) and the first time, it went off at 1h 30min, the second time at 1h. EDIT: It seems like the original script does not even work actually. As mentioned in two comments on the blog post, the script will tell SelfControl to start, but will not correctly set any new value; just use the last used value. So the question actually becomes, is this slider even possible to set in AppleScript? The second problem: Furthermore I want to have the script close specified programs (specifically the chat application Telegram) and open them again after the set time. This is where I run into trouble. I've tried this: tell application "Telegram" quit end tell delay q tell application "Telegram" to run And this works perfectly. The problem then is that the "SelfControl" application uses minutes and the "delay" command uses seconds as a time unit. I have naïvely tried to fix this by running "delay 60*q" but this doesn't work - the application never opens again. Any suggestions?
×
×
  • Create New...