The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Scripting support for Date entry shortcuts (http://forums.omnigroup.com/showthread.php?t=21593)

dbyler 2011-07-12 10:26 AM

Scripting support for Date entry shortcuts
 
I'd love to be able to access the OmniFocus date entry shortcuts via
AppleScript. E.g. the ability to type things like

[QUOTE]• 2d, -3w, 1h, 1y1m, and so on — Relative dates and times put the date
at a certain amount of time from right now. Negative numbers
represent times in the past.
• 2 days, -3 weeks, 1 hour, 1 year 1 month, and so on — You can use
the full names of units too.
• yesterday, tomorrow, next thursday, last month, this friday, and so
on — You can refer to relative dates using common words. “This”,
“next”, and “last” have specific meanings: this friday always means
the Friday in this week, next friday always means the Friday in the
next week, and last friday always means the Friday in last week,
regardless of what day today is. Other units work in the same way.
• september, thurs, 2019, and so on — If you enter the name of a
specific time period, the date will be at its beginning. So
september means Septem- ber first.
• 5/23/08 10a, 9.30.09 2:00 PM, and so on — You can use the short date
format as defined in your International system preferences.
[/QUOTE]
...as specified in the OmniFocus manual.

The OmniFocus `complete` command seems like a good candidate to
implement this. Possible usage:

[CODE] tell application "OmniFocus"
tell front document
set newDate to (complete "next thursday" as date)
end tell
end tell
[/CODE]
This would be _extremely_ useful in streamlining certain actions.

I've emailed [email]support@omnigroup.com[/email] to request this feature... if others think this would be useful, please email them too! :)

RobTrew 2011-07-13 01:19 PM

[QUOTE=dbyler;99497]I'd love to be able to access the OmniFocus date entry shortcuts via
AppleScript. [/QUOTE]

(In the meanwhile, if you lift the hood of [URL="http://bit.ly/OF-Find2"]Where in OF[/URL] you will find a simple (and, I hope, reusable) applescript implementation of a subset of these things.)

dbyler 2011-07-13 04:02 PM

Wow, Rob—that is a seriously impressive 2832 lines of code. I may extract your date parsing code at some point... although it would certainly be easier to use [CODE](complete "next thursday" as date)[/CODE] :)

whpalmer4 2011-07-13 04:49 PM

It used to be only about 1200 lines of code. Rob was a little slow to catch on that I had an endless stream of feature requests, and doing one didn't mean that I would be satisfied and go away, but rather that I would be encouraged to ask for another, more complicated one :-)


All times are GMT -8. The time now is 03:36 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.