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

RedTomato

macrumors 601
Original poster
Mar 4, 2005
4,161
444
.. London ..
I'm trying to build an ADHD task reminder for OSX, but I have very limited programming experience. Could you advise me please on the easiest method to accomplish it?

High-level overview:
  • From 9.30am to 4.30pm, on the hour, and at 30 mins past the hour, go to the calendar*
* (this could be any of Todoist / iCal / Gcal, whichever is easiest to make work. I have multiple calendars in iCal, so it would have to pick up only the task calendar, not all calendars)

  • If nothing there, do nothing.
  • If a task/event is set, 5 minutes before the event, display a small dialogue box with a reminder to wrap up the previous task, and a click button for OK to dismiss.
  • At the time of the event, blackout the screen, display large text with the name of the new event/task, and a click button for OK to dismiss.
Quite simple, but I've tried to build it in AppleScript & Automator & not got anywhere. Any advice on simplest way to make this happen?

iCal reminders etc don't do it for me, I need a full screen blackout.
 
Sounds like you need a program that loads on login, polls selected calendar for alarms, then scheduled screen actions at the appointed time.

I would start by building an array of alarms times, then running a background timer and polling it every 30 seconds or so to see if it is time to fire an alarm sequence, then blank the screen, fire up calendar, etc.

This would be my first idea. Then I’d run and watch in Activity Monitor to see if it is burning up tons of CPU cycles due to a timer running, then figure out if the timer needs to be optimized somehow to use less energy.
 
Sounds like you need a program that loads on login, polls selected calendar for alarms, then scheduled screen actions at the appointed time.

I would start by building an array of alarms times, then running a background timer and polling it every 30 seconds or so to see if it is time to fire an alarm sequence, then blank the screen, fire up calendar, etc.

This would be my first idea. Then I’d run and watch in Activity Monitor to see if it is burning up tons of CPU cycles due to a timer running, then figure out if the timer needs to be optimized somehow to use less energy.

Thanks for the suggestions. I've been able to implement nearly all of them.

I’ve built a MacOS shell script that polls iCal, grabs events, and is able to launch an action at the appropriate time. The only problem is I can't work out how to blank the screen or launch a big text/dialogue box that overlays the screen. I can launch a small dialogue box but that doesn't do it for me.
 
The only thing I could think of offhand is if you can open TextEdit full screen then write your notification to its window, if possible (don’t know if TextEdit exposes enough to do this).
 
The only thing I could think of offhand is if you can open TextEdit full screen then write your notification to its window, if possible (don’t know if TextEdit exposes enough to do this).

Good idea - after a bit of fiddling, I was able to - in the shell script - build a textedit rich text file, set it to large font, then insert info from ical, and save it all again. Calling it from the terminal opens a nice big window with the desired text.

However, I've run into a bit of a road block with the 'at' command. I said previously I was able to launch commands at the appropiate time. I was wrong, I can't make that work.

I've followed various guides to re-enable the 'at' command in osx, but now I am seeing in console every 30 seconds:

Macbook-Air com.apple.xpc.launchd[1] (com.apple.atrun[3446]): Service exited with abnormal code: 1

Checking with atq shows my timed actions sitting in the atqueue, but they never seem to actually run. It looks like I may need to use a different way of firing commands at set times.

I looked at scheduling via launchd but I can't make head or tail of how to rewrite on-the-fly launchd actions to fire at various times. There must be an easier way?
 
Can you set up an iCal event to fire off an Automator action at the scheduled time? iCal used to allow shell scripts to be executed, but I don’t know offhand if that is still a function and I don’t have a Mac nearby to check this.
 
Can you set up an iCal event to fire off an Automator action at the scheduled time? iCal used to allow shell scripts to be executed, but I don’t know offhand if that is still a function and I don’t have a Mac nearby to check this.

Thanks for the idea.
[EDIT - irrelevant stuff snipped]

Now I'm thinking about using Launchd to run a static script every 5 minutes. That script will get today's events from Calendar 2 and compare the event start time to the current time. If the difference is less than 5 minutes, it launches a Textedit window with the event info in large font. Hopefully that should be reasonably battery friendly.

What do you think?
 
Last edited:
Sounds like a good plan to me. That way you just need to find out which appointment is next instead of worrying about all of them.
 
Hey thanks, that's absolutely great!

I looked at your first link, tried to open the script, couldn't get any code and was a bit suspicious of the file, but the second link explained what it was & the switches etc. Still wish I could see the code, but for now it's great. I'll try to integrate it with my other code when I get time.

Thanks again, I looked for ages for something similar, but couldn't find anything.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.