Quick Reminders via Notification Center
<p>This is a simple script which takes input from Drafts.app (required) and then schedules a reminder at a specified time interval (in minutes) via the iOS Notification Center.</p>
<p>It requires the creation of a URL action in Drafts with the following URL: <code>pythonista://QuickReminder?action=run&argv=[[title]]&argv=[[body]]</code>; the script must be titled “QuickReminder” in order for that URL action to work. Change the action if you want to call it something else in Pythonista.</p>
<p>In Drafts, enter the text of your reminder on the first line. Hit 'return' twice, and then enter the amount of time in which you'd like to be reminded, in minutes, on the third line of the draft. Fire the action. Bingo.</p>
<p>I find this to be a very handy little script. Let me know if you run into any bugs.</p>
<p>Here's <a href="https://gist.github.com/jbwhaley/4deac45790fa339b537a">the gist</a>.</p>
fabr1z31 last edited by
I get an IndexError: list index out of range on "sys.argv"...
omz last edited by
@omz Thanks for catching that.
I've just updated the script so that it triggers an audio notification upon the successful creation of a new reminder. The original gist has been updated, so grab the code from there if you're interested in updating.
ccc last edited by
Extended tuple unpacking bug: <pre>a, *b, c = range(5)</pre> raises a syntax error in Pythonista. This PEP 3132 functionality should work but perhaps this is something that was fixed in the Transition from Python 2.7.0 to 2.7.5.
I was thinking that this script could benefit from the lines: <pre>. (programName, *message, delay) = sys.argv
delay = int(delay.replace(',', '')) * 60
notification.schedule(message, delay, 'default')</pre> but the first line is a syntax error in Pythonista.
omz last edited by
@ccc PEP 3132 only applies to Python 3.x.
bluefunk last edited by
Hi, I tried your script to test scheduled notification. It works, thanks :) I added an action so an app opens when I tap on the notification. However, the notification stays in Notification center after tapping on it. Do you know how to make it disappear after tapping on it (like 'regular' notifications on iOS)?
Sorry, bluefunk, I'm not sure how to do that--may be a limitation of the way that Pythonista schedules notifications.
Updated to version 2.0.
the_buch last edited by
I'm so happy this exists. Thank you! I use Drafts to create quick little reminders all the time. Unfortunately they often need to be scheduled or I'll forget anyway. Thus, it requires opening Reminders anyway. This is perfect, aside from figuring out longer minute numbers which is fine, and quicker than doing all that other stuff. Just tested it with a minute and it works! I tried 0.5 for 30 seconds but it won't take that. I noticed it said 60 or 1-60, something like that, on the line where the error was on that attempt. Is this the limit - 1 hour? Either way, this is handy.