Adding due dates in Wunderlist takes at least several clicks, especially if the due date is neither today nor tomorrow. The ability to specify a due date when creating a task would be terribly useful.
Command Syntax
There are a myriad of options for natural language date processing, but for the sake of getting this feature out the door the options will need to be limited. Applescript supports locale-based date formatting out of the box, so at a minimum it should handle explicit dates like "12/31/2013" or "Dec 31 2013".
It would be nice to handle relative dates too though they would have to be locale-neutral (e.g. "+5" rather than "5 days from today"). The workflow localization can provide support for units other than days, for example "4w", "3m", "1y" corresponding to weeks, months, and years in English.
The syntax should not be overly verbose but it is important to ensure that it does not have to be overhauled if a similar feature is added in the future for scheduling reminders. Pending final decisions on the syntax.
Implementation
The process of parsing the date will vary depending on the syntax selected, so for now let's focus on the implementation after the point where a date is known.
Insert task
tab key to move selection to the top of the task list
right arrow key to open the task details pane
Inspect UI to test if title of task details pane matches the task
up arrow if it does not match; user may have selected Add new items: Bottom of List in Wunderlist preferences, this will select the last item
Use cliclick to tap the due date field
Perform subtask: insert the date
Use cliclick to tap the check button to confirm the due date
left arrow to close the task details pane
Insert the date
Perform subtask: determine date format for the current locale
Use cliclick to tap the left side of the due date field
Send keystroke for the corresponding value in the target date
Repeat steps 1-2 for each of the 3 date values
Determine date format for the current locale
Create a static date such as
set {theDate, theDate's month, theDate's day, theDate's year} to ¬
{current date, 1, 2, 34}
Get the short date string of theDate which in the US will be 1/2/34
Split the string on non-numerics and determine the position of the day, month, and year
Arrange target date components into an array in the same order
Caveats
Date formats
International date formats could be an issue. If Wunderlist changes the display of the date based on the locale (e.g. mm/dd/yyyy vs dd/mm/yyyy), AppleScript should be able to provide a date string in the current locale. Rather than extracting the day, month, and year it may be best to get the locale string matching whatever Wunderlist uses and split that into string components that can be inserted in whatever order the locale specifies.
Performance
The Wunderlist app appears to hesitate when switching between the three date component cells. This may be problematic for automation timing.
Adding due dates in Wunderlist takes at least several clicks, especially if the due date is neither today nor tomorrow. The ability to specify a due date when creating a task would be terribly useful.
Command Syntax
There are a myriad of options for natural language date processing, but for the sake of getting this feature out the door the options will need to be limited. Applescript supports locale-based date formatting out of the box, so at a minimum it should handle explicit dates like "12/31/2013" or "Dec 31 2013".
It would be nice to handle relative dates too though they would have to be locale-neutral (e.g. "+5" rather than "5 days from today"). The workflow localization can provide support for units other than days, for example "4w", "3m", "1y" corresponding to weeks, months, and years in English.
The syntax should not be overly verbose but it is important to ensure that it does not have to be overhauled if a similar feature is added in the future for scheduling reminders. Pending final decisions on the syntax.
Implementation
The process of parsing the date will vary depending on the syntax selected, so for now let's focus on the implementation after the point where a
date
is known.tab
key to move selection to the top of the task listright arrow
key to open the task details paneup arrow
if it does not match; user may have selected Add new items: Bottom of List in Wunderlist preferences, this will select the last itemcliclick
to tap the due date fieldcliclick
to tap the check button to confirm the due dateleft arrow
to close the task details paneInsert the date
cliclick
to tap the left side of the due date fieldDetermine date format for the current locale
short date string of theDate
which in the US will be 1/2/34Caveats
Date formats
International date formats could be an issue. If Wunderlist changes the display of the date based on the locale (e.g. mm/dd/yyyy vs dd/mm/yyyy), AppleScript should be able to provide a date string in the current locale. Rather than extracting the day, month, and year it may be best to get the locale string matching whatever Wunderlist uses and split that into string components that can be inserted in whatever order the locale specifies.
Performance
The Wunderlist app appears to hesitate when switching between the three date component cells. This may be problematic for automation timing.