Editorial Workflows

TaskPaperReminders

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Creates a reminder in the iOS reminders app as well as setting an alert to sound for all task paper @alert tags in a document.
Alert format is assumed to be:
alert name @alert(yyyy-mm-dd, HH:MM)

Shared by: Cethric

Comments: Comment Feed (RSS)

anonymous — 15 Jan 2016
Not working... Any solution?
JSLR — 16 Jan 2016
"Line 12: Value error: need more than one value to unpack."

Also, I could be wrong, but the script seems to be looking for @alarm() rather than @alert()?

+ Add Comment

Workflow Preview
Get Document Text ?
Folded Text
  • Include
  • Replace with:
Run Python Script ?
Source Code
#coding: utf-8
import re
import editor
import dialogs
import datetime
import workflow
import reminders

action_in = workflow.get_input()
for line in action_in.split('\n'):
	for name, s_time in re.findall(r'(.*)@alarm\((.*)\)', line):
		date, time = s_time.split(', ')
		d_yyyy, d_mm, d_dd = [int(x) for x in date.split('-')]
		t_hh, t_mm = [int(x) for x in time.split(':')]
		rem = reminders.Reminder()
		rem.title = name
		due = datetime.datetime(d_yyyy, d_mm, d_dd, t_hh, t_mm)
		rem.due_date = due
		a = reminders.Alarm()
		a.date = due
		rem.alarms = [a]
		try:
			res = dialogs.alert(
															'The Reminder Was Set',
															'Name: {name}\n{date} {time}'.format(
																																					name=name,
																																					date=date,
																																					time=time),
															'Ok')
			rem.save()
		except KeyboardInterrupt:
			print "User Cancled Input"
		

action_out = action_in

workflow.set_output(action_out)