The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   AppleScript Requests (http://forums.omnigroup.com/showthread.php?t=4327)

kaebot 2007-07-27 10:53 AM

AppleScript Requests
 
We've had a few requests for some scripts over here that we'd like to do, but haven't had a chance. If anyone out there finds themselves with a spare moment and feel so inclined to help out their fellow user, we'd really appreciate it!

Here's the list so far (more to come):[LIST][*] A script to parse out TODOs from TextMate and send them to OF.[*] Integration with MailTags.[*] A script to create Mail messages from actions.[*] A Now Up-To-Date to OF and vice versa script.[*] Integration with Entourage[*] Export to Pages, Microsoft Word, and Evernote[/LIST]

smew 2007-09-01 08:52 PM

Please - a script to launch Minuteur!
 
I would love to be able to truly decide what I will be doing now from Omnifocus. An ideal way would be to select an action and run a script that launches Minuteur counting down from the estimated time necessary to complete the task.

Tim Wood 2007-09-06 07:17 AM

I'm not sure this addresses the request, but you can create an AppleScript and put it in the OmniFocus scripts directory and finally configure OmniFocus's toolbar to have the script (alternatively you can use something like FastScripts or Quicksilver to activate it from the keyboard).

leehinde 2007-09-12 10:20 AM

I'd like it if I had a list, (as might come from an email)
Like:
1. Please do this
2. Please do that
3. Oh, and this other thing.

I'd like to select the list, hit a button and have three new actions created.

ext555 2007-09-12 10:32 AM

Omni has stated that email capture is on their list for 1.0 release ..
I think what you'll see is one action generated from each email .

leehinde 2007-09-17 12:28 PM

Hi; thanks. I'm using a script now to get an email into OF. But I wanted to break them out when the client includes multiple requests in a single email.

A [URL="http://forums.omnigroup.com/showthread.php?t=4883"]script was posted[/URL] that works just fine for my needs.

milkshake 2007-10-02 07:25 AM

My phone (Nokia) exports notes (via Bluetooth) as individual text files, so I'd appreciate a way to import each text file as an action...

Adam Sneller 2007-10-11 09:47 PM

Entourage Integration
 
I'll take on the Entourage integration. I worked up a set of scripts that glued Entourage with OOP a while back. But I'd love to hard-wire this into a cocoa plug-in for OmniFocus!

Do we know if there'll be an OF API available, or is it all AppleScript? If Sync Services is fully supported, this may be a relatively easy fix!

Craig 2007-10-15 05:25 AM

I'm a happy user of Curt Clifton's "What am I doing?" script. I wonder if someone with some scripting skills could alter it so that it could be invoked when multiple actions are selected. I'd love to be able to go through a list adding to the selections, then with one invocation of the script launch separate sticky Growl windows for each of them.

(Original script appears [URL="http://forums.omnigroup.com/showthread.php?t=4947"]here[/URL].)

mikesale@yahoo.com 2007-11-21 04:27 AM

Already exists, but I would love to see it more formalized:
* Export/Import to/from OmniOutliner
Then add:
* Create mindmanager mindmap from OF
* Create folder for project
The "big" one that would really be cool!
* Create directory structure that mimics folder structure with projects for "Project Support Materials" that map to your project structure in OF! Then create an alias in each project notes section to map to the relevant folder.

Teall 2008-02-01 06:56 PM

I would love a script that would export tasks to Address Book notes with the name the @List. Then i could sync with my iPhone, for example:

@Calls
Note: -Call Mom
-Call Boss

thr61 2008-03-20 01:23 PM

Create "Waiting For" NA prior to mail send
 
I am a fairly new mac and OF user who came over from the dark side of XP and Outlook. One decent tool amid the bloat was the David Allen Outlook plugin which had the ability to create an "@waiting for" next action that contained the subject matter of the email being sent.

I know that I can go into my sent items in Entourage (still need it for Exchange) and use the Entourage to OF script to put the item in my inbox, but a script that could grab the addressee, date and subject line and dump a waiting for into the OF inbox would be amazing.

I have no coding or scripting skills myself, so I dare not try.

Thanks!

eco-geek 2008-03-27 12:06 PM

Sync with SplashShopper (a list manager)
 
I would love to have a script that would sync OmniFocus with SplashShopper ([url]www.splashdata.com[/url]), and here's why. It occurred to me that SplashShopper is really just a list manager and GTD is really about managing lists. This makes them a perfect match. Also, SplashShopper has both an OS X desktop app and a Palm app and they supply their own sync conduit which works flawlessly.

In both apps, SplashShopper has the ability to filter items based on "Stores" (Projects) and "Categories" (Contexts). You can also mark an item as "Needed", which in my mind equates to "Next", thus I can keep all identified project actions in the main view with only the next action(s) marked as "Next" (which will show up in the "Needed" view).

I know a little about Applescript, but nowhere near enough to accomplish something like this. And I'm a grad student, so the amount of time I can devote to learning is terribly limited at this point. So can anyone cobble together a script that might do this? Alternatively, can you point me to something that might serve to get me started? Thanks!

sirvivian 2008-05-27 03:01 AM

I second everything mikesale wrote - especially the "big" one!!!

henri 2008-06-29 08:19 AM

[FONT=Georgia]I have an OO script which I used to use daily: it would take all dates less than today's and turn them into today. For example, if today's date is June 29, all dates up to June 28 would magically become June 29.

Why this would be useful in OF: one of my most useful perspectives is "group by start date, sort by due date". It would be convenient to not have a distinction between "started yesterday", "started in the last week", etc. and "start today", since the difference is moot.

So I would activate this script first thing in the morning, and have all tasks whether started in the past or starting today grouped together, because after running the script they would all be "start today".

Actually, such a script would need to ignore repeating tasks, as I wouldn't want to mess with their start dates.

I'm not that great with AppleScript, but I could try to do this myself if I had some sample OF scripts that address those sorts of issues. Where would those be?
[/FONT]

ales 2008-07-18 10:22 PM

[QUOTE=Craig;22901]I'm a happy user of Curt Clifton's "What am I doing?" script. I wonder if someone with some scripting skills could alter it so that it could be invoked when multiple actions are selected. I'd love to be able to go through a list adding to the selections, then with one invocation of the script launch separate sticky Growl windows for each of them.

(Original script appears [URL="http://forums.omnigroup.com/showthread.php?t=4947"]here[/URL].)[/QUOTE]

I second Craigs request. I would love a feature so that i could select a single action, press a keyboard shortcut and send it to growl, which would make the task sticky on my screen. I would do the same with 2 or max. 3 other tasks and that would really improve my multitasking.
Right now, i'm doing it like this. I also have iGTD2 installed which has this feature and then i select the tasks i'm doing in OF, copy them over into iGTD2 inbox and then use the keyboard shortcut to send them to growl.

I believe Curt.Cliffton is the original author of the WhatAmIdoing script and Curt, if you have the knowledge (which i believe you have) and the time to code this, i'll buy you a beer if you ever come to Slovenia. Heck, i'll buy you a sixpack :) I just hope Curt is reading this thread.

JakeB 2008-09-24 07:23 AM

Adding Time Estimates
 
I hope that adding another applescript request to this thread is appropriate.

I would love to be able to select a series of actions and to sum the estimated time across them. The StartTimer.scpt seems to do almost all of what I'd like, but rather than start Minuteur, I'd like just to get a dialog box with the sum that I could copy and past back into Omnifocus as the time estimated for the whole project (or, even better just have the time estimated for projects be defined as either (1) user supplied number or (2) the sum of the estimates of the actions.

I'll hack around on this a bit on my own. But, I am not an Applescript programmer and figured this might be faster for a more experienced person.

Thanks!

Jake

mattyork 2008-10-16 09:24 AM

I'm sure someone has put this somewhere but I don't yet see it on here. Since the iPhone doesn't handle to-do items on sync, and OF handles them much more elegantly anyways is there a way to convert OF actions to iCal calendar entries (not to-do items) w/ a default alarm? MobileMe users can then sync their iPhones with their iCal which would then include the alarms for each task.

Frank M 2008-12-19 01:05 PM

Add selected contact
 
I'd like an Applescript that does the following:

I select a name in a task, or a task description or a project.

The script checks to see if that name is in my address book.

If it is, it attaches the contact (as if I had dragged it from the address book onto the task, so that when I 2click it that it opens the address)

If not such contact is found, it warns me that it can't find it, then [cancel] or [open address book]

In an ideal world, if there is more than one matching contact (should not happen, but it can) if there's more than one match, it presents a list with fundamental details (name, company, phone) to choose from, and 2clicking it attaches the contact.

In a super mega hyper ideal, OmniGroup would make this functionality part of a context menu-with a read-ahead list. <-- Dear OmniGroup: This is a feature request!

whpalmer4 2008-12-19 01:32 PM

[QUOTE=Frank M;52626]
In a super mega hyper ideal, OmniGroup would make this functionality part of a context menu-with a read-ahead list. <-- Dear OmniGroup: This is a feature request![/QUOTE]
If you want a feature request to be noticed, use Help->Send Feedback or send email to [email]omnifocus@omnigroup.com[/email] so that it is logged into the tracking system.

Frank M 2008-12-19 02:27 PM

[QUOTE=whpalmer4;52628]If you want a feature request to be noticed, use Help->Send Feedback or send email to [email]omnifocus@omnigroup.com[/email] so that it is logged into the tracking system.[/QUOTE]

Done. Thanks!

Pauly17 2009-01-12 12:10 PM

sync with Toodledo and OF
 
Could someone help me out here.. I have he app for syncing toodledo and OF and I have no clue as how to set up the script to run it. I have the button in the title bar but when I hit it it tells me "AppleScript reported the following error: List is empty." I click on Edit Script and this is in the script Editor

set pathToLib to (path to preferences as string) & "com.ptone.OFTD_lib.scpt"
set tdsync to load script alias pathToLib
tell tdsync to run

It said I in the directions I have to put in my account info

Toodledo account email:

Store Toodledo password: If you choose to store the password, it will be stored in clear text in a plist file in your preferences folder

Toodledo password: Your Toodledo password (If you chose not to store it,you will be asked for it later)
Also Sync Inbox:
Could someone help me out here...
This is my first mac and I only had it for a week... Love it so far but I have lots to learn.. Be easy on me fellas I'm a Virgin!!
Thanks in advance for your time..
Paul...

devarshi 2009-09-17 11:09 PM

Omnifocus - Entourage integration via Quicksilver
 
Omnifocus - Entourage integration via Quicksilver

Check it out here :

[url]http://blog.nthmuse.net/?p=104[/url]

DamonC 2009-10-21 09:54 PM

Could the first post be updated with the outstanding AppleScript requests? I'd be happy to chip in here if I know what is required.

Jody Severson 2010-01-22 03:28 PM

Request script for speeding up database
 
I've just had some excellent (!!!!!) tech support from Kris, a support ninja, about the process of exporting an Omnifocus document, then reverting to that exported version as a way of flattening the OF file so that it syncs faster with my iTouch. If someone out there would like to put that process into an apple script, we'd have a one-click way to slim down the file. Many thanks!

aslansmane 2010-03-15 10:32 PM

AppleScript for Printing Perspectives
 
Just curious if anyone has had any luck writing a script that would allow you to print a specific perspective? I'd like to have OmniFocus automatically open and print a perspective for work so that when I wake up I can grab my to-do list off the printer.

Is that possible? I know nothing about AppleScript.

theurge 2010-06-26 08:06 AM

request- .txt file list to separate inbox items script
 
My wife and I have a shared dropbox folder where she periodically drops a .txt file list of stuff she'd like me to do from her windows machine, which I open, copy the list and paste it in the inbox, using the method that splits each line into a separate task.

I would love to do something like: have hazel watch that shared folder for a new .txt file, grab it and run an applescript that will do the above automatically.

I'm a complete novice with applescript, but I've done a lot of reading and seen little snippets of script that look like parts of what I would need, but I've had no luck putting them together. Any ideas folks?

Lusule 2010-11-19 04:57 AM

Request for Geek tool script
 
I would like an apple script that takes all my available tasks from Omnifocus and outputs them to shell. I could then use this script in Geek tool to embed my active tasks list on my desktop where I can see it.

I did find a script called ListNext.scpt which does something similar, but I can't get it to work quite right - it only seems to display a small fraction of my tasks list, perhaps only those tasks which are actually next actions in a sequently project?

I need to display every task, even the little niggling random ones that get pooled together in a miscellaneous box. I make aggressive use of start dates to ensure that only tasks I could actually consider doing that day are available but if I don't have everything easily visible on my desktop, I always end up forgetting something important.

I used to just export to iCal with the iCal sync to achieve this - literally dragging all my contexts over to my calendar and then using iCalBuddy. However I recently had to upgrade my mobileme calendars so this doesn't work anymore :(

RobTrew 2010-11-19 09:11 AM

[QUOTE=Lusule;89135]I would like an apple script that takes all my available tasks from Omnifocus and outputs them to shell. I could then use this script in Geek tool to embed my active tasks list on my desktop where I can see it.
[/QUOTE]

I would probably use Sqlite to do this - designing an SQL query that fetches the list you want.

"Available" is used in quite a complex sense in the OF filter system - (tasks which are neither waiting their turn in a sequential project, nor already completed, nor deferred by a future start date (either of their own or inherited from a project or Single Action list), nor out of action because their project or context is on hold or dropped).

I notice, however, that you also use the word "active" to describe the list you want, so perhaps you simply want all tasks which are not completed ?

In any case, a prototype of what you need might look something like this:

[CODE]property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"
property pstrFieldDelimiter : tab


-- set strQuery to "PRAGMA TABLE_INFO(Task);"

set strQuery to "
select name from task where dateCompleted is null;
"
runquery(strQuery)

on runquery(strQuery)
set strCmd to "sqlite3 -separator '" & pstrFieldDelimiter & "' " & pstrDBPath & space & quoted form of strQuery
strCmd
do shell script strCmd
end runquery[/CODE]

and you can get a list of the other available fields, and their data types by running the query:

[CODE] PRAGMA TABLE_INFO(Task);[/CODE]

Note that the SQL structure of the OmniFocus cache can change from version to version, so you might have to amend the code next time OF is updated.

Lusule 2010-11-19 11:52 AM

[QUOTE=RobTrew;89144]I would probably use Sqlite to do this - designing an SQL query that fetches the list you want.[/QUOTE]

Thanks RobTrew! However I realised when I went away and put my sensible head on that what I wanted was actually a lot simpler than I realised. I went away and created a 'Now' perspective in Omnifocus that did exactly what I want: View Contexts remaining, ungrouped and sorted by context where availability is Available Status is Any Status and Duration is Any Duration.

I then used a nice simple script (below) that I found by [URL="http://concisionandconcinnity.blogspot.com/2009/06/plaintext-task-list-from-omnifocus-with.html"]Ian McCracken[/URL] to export the tasks from that context to Geek Tool. I even managed to customise the script so the list organised neatly with bullets!

It's not perfect, since it does seem to change your Omnifocus view to that perspective whether you are doing something else in Omnifocus at the time or not. However for my purposes, that's an acceptable payoff for ease of use.

Anyone could use this script for any preferred perspective by replacing the line

[CODE]set perspective name to "Now"[/CODE]
with
[CODE]set perspective name to "<your perspective here>"[/CODE]

If you want the brackets at the end to show project rather than context, change

[CODE]set projContext to name of context of oTask[/CODE]
to
[CODE]set projContext to name of containing project of oTask[/CODE]

Hope this helps people!


[CODE] set taskList to ""
tell application "OmniFocus"
tell the default document to tell the front document window
set perspective name to "Now"
set oTrees to trees of content
set n to count of oTrees
repeat with i from 1 to n
set oTask to value of (item i of oTrees)
set taskTitle to name of oTask
set projContext to name of context of oTask
set taskList to taskList & " • " & taskTitle & " (" & projContext & ")
"
end repeat
end tell
end tell
return taskList [/CODE]

whpalmer4 2010-11-19 09:49 PM

Here's a slightly improved version. It creates an invisible window to do the data extraction, so your existing windows aren't affected, and it handles the case of an action without a context.

[code]
property TargetPerspective : "Geek Tool" -- set this to the name of the perspective that shows desired actions

set taskList to ""
tell application "OmniFocus"
tell default document
set _window to make new document window with properties {visible:false} at front of document windows
tell _window
set perspective name to TargetPerspective
set oTrees to trees of content
set n to count of oTrees
repeat with i from 1 to n
set oTask to value of (item i of oTrees)
set taskTitle to name of oTask
try
set projContext to name of context of oTask
on error
set projContext to "(No Context)"
end try
set taskList to taskList & " • " & taskTitle & " (" & projContext & ")
"
end repeat
end tell
close _window
end tell
end tell
return taskList
[/code]

Lusule 2010-11-20 01:42 AM

[QUOTE=whpalmer4;89182]Here's a slightly improved version. It creates an invisible window to do the data extraction, so your existing windows aren't affected, and it handles the case of an action without a context.
[/QUOTE]

That is just brilliant whplamer4! Thank you! I had actually only just encountered the 'no context' problem and here you've already solved it for me. Moving the Perspective name to the start is handy too.

I'm really happy with this script now :) Should cover most eventualities and means the fact that mobileme iCal no longer works with Omnifocus is not an issue.

RobTrew 2010-11-20 01:04 PM

As a curiosity, here is an Sqlite version. Arguably less easy to maintain (the SQL queries are probably less transparent than applescript, and might need to be adjusted for later versions of OF).

On the other hand, it's rather short and simple, works even when OmniFocus is not running, and is quite fast.

[CODE]property pstrDBPath : "~/Library/Caches/com.omnigroup.OmniFocus/OmniFocusDatabase2"
property pstrFieldDelimiter : tab

set strQuery to "
select \"• \", t.name, \"(No Context)\" from task t where context is null order by t.name;
select \"• \", t.name, c.name from task t join context c on t.context=c.persistentIdentifier
where effectiveActive=1 and dateCompleted is null order by c.name, t.name;
"
set taskList to runquery(strQuery)

on runquery(strQuery)
set strCmd to "sqlite3 -separator '" & pstrFieldDelimiter & "' " & pstrDBPath & space & quoted form of strQuery
do shell script strCmd
end runquery[/CODE]

RussBlaisdell 2011-01-05 04:51 PM

Hi,
I have a script that works as a folder action that I could share that should get you close to what you are looking for. I am not sure if folder actions work with Delphic so it might need to be scheduled to run. If you are still looking just reply and I will post it

RussBlaisdell 2011-01-05 04:55 PM

My previous port was in reply to
[QUOTE=theurge;79232]My wife and I have a shared dropbox folder where she periodically drops a .txt file list of stuff she'd like me to do from her windows machine, which I open, copy the list and paste it in the inbox, using the method that splits each line into a separate task.

I would love to do something like: have hazel watch that shared folder for a new .txt file, grab it and run an applescript that will do the above automatically.

I'm a complete novice with applescript, but I've done a lot of reading and seen little snippets of script that look like parts of what I would need, but I've had no luck putting them together. Any ideas folks?[/QUOTE]

fullcity 2011-03-22 07:08 AM

@Waiting from MailTags to OF
 
Hi!

I bet my request is simple and I merely have been too lazy in searching the archives for an answer. :-)

I'd like to ge able to tag an outgoing email with a specific MailTags tag "@Waiting" and have a rule fire an AS to create a follow up to do in OF. The date for the follow up would pull from the Tickler date or a default # of days if not specified.

As a bonus, the OF Context for the task could be determined from the outgoing email address if it is one of the people on my team (5 people).

I'll hire someone to work on this with me if there isn't something here easily convertible.

Thanks,
Adam Aronson
FullCity Consulting Inc.

Certified FileMaker Developer (Ver. 7, 8, 9, 10 & 11)
Platinum FileMaker Business Alliance Members
2007 FileMaker Business Partner of The Year

[url]http://fullcityconsulting.com[/url]

theurge 2011-12-31 03:33 PM

request- .txt file list to separate inbox items script
 
Sorry, RussBlaisdell, its been a while, and this little project has just dropped of my radar. I would love to have a look at what you've got. I'm not sure how much time or intelligence I have to do anything with it, but you never know. Thanks.

[QUOTE=RussBlaisdell;91261]Hi,
I have a script that works as a folder action that I could share that should get you close to what you are looking for. I am not sure if folder actions work with Delphic so it might need to be scheduled to run. If you are still looking just reply and I will post it[/QUOTE]

Noel Roy 2012-07-04 05:16 PM

Text add to omnifocus
 
I would second that I would really like a script that would read a text file and add an item from each line.

I use a script right now where I select each line and send it to LaunchBar. Launchbar makes a task in omni, and it accepts this form: task >project @context

If there were a way to put each line into this script... or each line within a certain marker? I'm not a programmer, it seems like an easy task, but I don't know.

The Launchbar script is at:

[url]http://forums.obdev.at/viewforum.php?f=24[/url]

RobTrew 2012-07-04 10:23 PM

[QUOTE=Noel Roy;112296]I would second that I would really like a script that would read a text file and add an item from each line.

I use a script right now where I select each line and send it to LaunchBar. Launchbar makes a task in omni, and it accepts this form: task >project @context

If there were a way to put each line into this script... or each line within a certain marker? I'm not a programmer, it seems like an easy task, but I don't know.

[/QUOTE]

There are probably a number of variants out there, but something roughly like this would be one simple approach (for selecting several lines and using LaunchBar 'Instant Send' (dbl option tap, for example) to process them in one batch, making each line into a separate task).

[CODE]-- LaunchBar script for parsing several lines of selected text to several tasks

on handle_string(str)
tell application id "OFOC"
if str ≠ "" then
-- PARSE TASKS
set lstParas to paragraphs of str
tell default document
repeat with oLine in lstParas
parse tasks with transport text oLine
end repeat
end tell

-- AND REPORT SUCCESS WITH A GROWL NOTIFICATION IF GROWL IS RUNNING
my Growlify("Create OF Tasks from text", "OF Tasks created", ¬
((count of lstParas) as string) & " tasks created in OmniFocus:" & return & return & str)
end if
end tell
end handle_string


on Growlify(strApp, strNote, strMsg)
tell application id "sevs"
if (count of (processes where bundle identifier is "com.Growl.GrowlHelperApp")) > 0 then
tell application id "com.Growl.GrowlHelperApp"
register as application strApp all notifications {strNote} ¬
default notifications {strNote} ¬
icon of application "OmniFocus"

notify with name strNote title strNote ¬
description strMsg application name strApp
end tell
end if
end tell
end Growlify
[/CODE]

Noel Roy 2012-07-07 05:41 PM

Thank you so so much Rob!! This is totally amazing.

-Noel.

ende 2012-09-14 09:04 AM

OmniFocus to Evernote
 
I'm looking for a fairly simple applescript. I want to take the currently selected project (or the project of the currently selected task) and send its attached contents to an Evernote name with the same name of the project (appending if it already exists).

aeiou112358 2012-10-18 04:11 AM

Applescript for repeating tasks?
 
Hi there.

I have a very very simple request. I just need an applescript that automatically sets the task that i am writing down in the QuickEntryWindow to repeat. How do I do that?

Sorry if the question is a bit dumb, but I can not find anything and my applescript knowledge is zero.

Many thanks, aeiou

jb_bryant 2012-10-19 08:46 AM

Copy Evernote link and paste in notes field of clipper
 
Since the clipper doesn't work properly in Evernote, I'm thinking it'd be nice to have an applescript to copy the note link, pull up the quick entry, and paste the link into the notes field. Then I could assign this to a keyboard shortcut.

Right now I've assigned the "Copy Note Link" menu icon to the same hotkey as the clipper, and then I have to pull up quick entry and paste it into the notes field manually. It seems like this could be done with an applescript and then used with fastscripts/Alfred/etc. but I know nothing how to write applescript.


Thanks!

ilhankudeki 2012-11-12 03:58 PM

Here is my request for a potentially very useful script for just getting started on something when you don't know what to do:

[B]Make an app or AppleScript that presents you one next action from OF at a time, where you either complete the action and check it off, or "next" it.[/B]

This would be at random, from any project or single action list.

Often times I'm afraid to look at my OmniFocus because those lists are so long and full that I'd love to have this tool to just get [I]doing[/I] instead of having to pick the best thing to do next.

whpalmer4 2012-11-14 07:09 PM

There used to be an OmniFocus dashboard widget called OmniFidget that did pretty much exactly what you ask. Unfortunately, it has joined the great software scrap heap in the sky...

Here's a radical suggestion: Put OmniFocus in context view. Close your eyes. Move the mouse somewhere on the sidebar and click on a context. Open your eyes. Do the first thing listed in that context, or pick another context in the same way. You don't really need software to do this for you, it just makes it more likely you'll play with the tool instead of actually doing something. I know all about this problem :-)

LeJoh 2012-12-21 11:40 AM

Hey there,
I use Hazel to watch some Dropbox folders for changes.
Now I´m looking for an applescript to add a new task to OmniFocus with specified context, project and an attachment of the altered document every time Hazel recognizes a change in a certain Dropbox folder.

I found snippets for either automatically adding a task to a specific project and context or to create an inbox task with an attached document. But so far I wasn´t able to fiddle them together to perform the action described above.
It can´t be that hard, but I just don´t get it.

whpalmer4 2012-12-21 11:31 PM

LeJoh, did you see this thread? [url]http://forums.omnigroup.com/showthread.php?t=20161[/url]

I downloaded a demo copy of Hazel and did a bit of fiddling with the script from that thread. I was able to get it to watch a certain file in a folder and make a new OmniFocus action with that file attached and project and context set each time the file changed.

Here's the script I used:
[code]


tell application "OmniFocus"
tell application "Finder" to set file_name to (name of theFile)
tell front document
set NewTask to make new inbox task with properties {name:file_name}
tell the note of NewTask
make new file attachment with properties {file name:theFile, embedded:true} -- embed file
end tell
end tell
try
set task_project to item 1 of (get flattened projects of front document whose name is "Test project")
set assigned container of NewTask to task_project
set context of NewTask to item 1 of (get flattened contexts of front document whose name is "Home")
tell front document to compact
end try
end tell
[/code]

Obviously, you'll want to change it to have appropriate values of "Test project" and "Home" :-)

I set up the rule to run if the Date Modified of the watched file is after the Date Last Matched, and invoke the script above.

Better ask me any other Hazel-related questions quickly, before my 14 day demo runs out :-)

LeJoh 2013-01-01 08:41 AM

whpalmer4, thank you so very much! Your script works exactly as I hoped my attempts would do. You made my day :-)

thompson.h 2014-01-16 03:23 PM

Snooze Function AppleScript
 
Hi everyone!

I've been using OmniFocus for years and I miss a simple functionality for repeating tasks: snooze (without changing the repeating pattern of the original task, like a one-off). Other applications does have this functionality, allowing the user to postpone and at the same time keeping the repeating pattern, so in the next occurrence the task behaves like it ever did. Unfortunately OmniFocus doesn't support this feature yet, because of the way repeating tasks are implemented, but I'm pretty sure that a workaround through an AppleScript is possible.

I just started studying AppleScript, so I have no idea how to implement it yet, though I know what must happen after the script is activated:

1. The task (or project) is duplicated;
2. The original task is marked complete, so the next occurrence will be available according to the original pattern;
3. The duplicated task has its repeating property removed, the script asks the user for a defer date (or relative date);
4. The duplicated task is then deferred.

For example:

Let's say I have a task set to start on July 5th and due on July 10th (set to start again on the next month). If, for any reason, I can't do the task on July 5th (but only this month), I change the start date to July 7th.

Without the script, OmniFocus will alert me again on July 7th, and once I check the task completed, the task will be available again on July 7th on the next month (and not on July 5th, like the original setup).

With the script, the task will be duplicated, the original task will be marked complete, so the next occurrence will be available on July 5th of the next month. The duplicated task will have its repeating property removed (to prevent it from repeating like the original and making a mess), the script will then ask the user about the next start date. The task is then deferred and that's it!


All times are GMT -8. The time now is 12:12 AM.

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