The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Scripting QuickEntry Thread Tools Search this Thread Display Modes
I see some AppleScript dictionary support for QuickEntry in the latest build. Anyone figured out how to open the QuickEntry window from AppleScript yet?
__________________
Cheers,

Curt
 
Heh; I was just about to come post something about this.

Here are some examples:

Code:
tell app "OmniFocus"
   tell quick entry
       -- activate the quick entry panel for the default document
       -- unlike the UI hook this won't add the default empty task
       activate
   end
end
Code:
tell app "OmniFocus"
   tell quick entry
       make new inbox task with properties {name:"foo"}
       select {task 1}
       save -- saves, closes and clears the panel as if you'd hit the 'Save' button
   end
end
Code:
tell app "OmniFocus"
   tell quick entry
       close saving no -- discards the data; yes saves
   end
end
Code:
tell app "OmniFocus"
   tell quick entry
       close -- with no 'saving' specified, just hides the panel w/o saving or reverting the data.
   end
end
The 'delete' command and tree suite should be supported too (quick entry is a subclass of tree in the script suite), though I've only tested the select command so far.

All the rich text & attachment scripting should work too on task notes as well, but it's received only limited testing in the Quick Entry configuration (the code is nearly all shared, so if something is busted it should be pretty easy to fix).

I still need to support the 'complete' command and as of yet, trying to assign a context or project to an inbox item will not work if you try to mix-n-match objects from different documents (where quick entry acts like a little document of its own). You could probably work around this (untested) by finding the project/context you want in the main document and then doing something like:

Code:
   tell quick entry
       set context of MyTask to context id (id of MyContextFromDocument)
   end

I would like to find time to auto-map these sorts of assignments, but I don't know if I'll find time before 1.0.

Last edited by Tim Wood; 2007-10-09 at 08:45 PM..
 
I should also mention that what I'm working on now is a clipping service with support for post-clipping script handlers to make cleanup/extensions to the clipped text based on the active application's state.

I'm out of town next week and I don't know if this will be committed before I go -- hopefully!
 
Anyone have any luck with this? I tried modding Curt's Mail script to open the Quick Entry and just start a new entry with title & note, but it's not working for me - even just opening the Quick Entry doesn't seem to work!

I get:
Code:
	open quick entry
		"OmniFocus got an error: Can't make quick entry into type file."
 
I get the same thing for open. I can get the 'make new inbox task' command to work on the QE window. Select and save also work. I opened the QE window using the hotkey, then ran this script:

Code:
tell application "OmniFocus"
	tell quick entry
		make new inbox task with properties {name:"foo"}
		select tree 1
	end tell
end tell
That part works. I'm guessing that Tim might have missed one commit before heading out so that the open command isn't implemented. I'll report via Send Feedback.
__________________
Cheers,

Curt
 
Bah; that's what I get for posting and then leaving for a week.

It turns out this works fine on my machine running 10.5, but not so much on 10.4 and I failed to run the test suite on 10.4 before claiming this worked.

Sorry for the false alarm -- I'll look into it.
 
OK, this should be better as of 92548. I've switched to using 'activate', which doesn't assume that its direct parameter is a file or list of files. No idea why this worked on 10.5... this is what I wanted to use in the first place, but then I got distracted and used 'open'.

I'll update the example above too for posterity.
 
Tim, we're almost there.

Here's what I almost have working now:

Code:
tell application "OmniFocus"
	tell quick entry
		-- Need to make task before activating or we get two tasks
		make new inbox task with properties {name:"foo", note:"bar"}
		activate
		-- Need to use tree 1, rather than {task 1} as in
		-- posted example
		select tree 1
		set note expanded of tree 1 to true
	end tell
end tell
If I activate before making the new task, then I get two tasks: the "foo" task added by the script and a new empty task.

If I add the task before activating, then the task pane in the QE window does not have focus. That necessitates a trip to the mouse in order to edit the new task.

Also, no joy in setting the context of the QE task.
__________________
Cheers,

Curt

Last edited by curt.clifton; 2007-10-10 at 02:47 PM..
 
Here is a script I wrote that sends a selected mail message to the Quick Entry panel. This will create a new task with a name set to the subject line of the email and the content of the message as a note. Seems to work pretty good.

The only thing I don't like is that, when Quick Entry opens, the buttons have focus. Anybody know how to shift focus to the task window?

Hope this helps!

Code:
(*	New OmniFocus Action from Mail.app Message

	Written by Adam Sneller 
	Copyright October 10, 2007.  All rights reserved.
	
	Version 1.0

*)

tell application "Mail"
	
	-- get the currently selected message(s)
	set these_messages to selection
	
	-- if there are no messages selected, warn the user and then quit
	if these_messages is {} then
		display dialog "Please select a message first and then run this script." with icon 1
		return
	end if
	
	-- loop through messages
	repeat with this_message in these_messages
		
		-- create link to message
		set this_link to "message://" & (message id of this_message as string)
		
		-- create task content and link to message
		set this_subject to subject of this_message
		set this_content to this_link & return & return & this_subject & return & date received of this_message & ¬
			return & return & content of this_message
		
		-- send task to OmniFocus
		my pushToQuickEntry(this_subject, this_content)
		
	end repeat
end tell

on pushToQuickEntry(get_name, get_note)
	tell application "OmniFocus"
		tell quick entry
			set this_task to make new inbox task with properties {name:get_name, note:get_note}
			select {this_task}
			activate
		end tell
	end tell
end pushToQuickEntry
 
Adam, I'm not sure if you were trying to help me here, but the problem I'm having is the same one you're having. The tasks in the QE window don't have focus. (I've had the Mail side of it licked since June. See that script and my others on my software downloads page.)
__________________
Cheers,

Curt
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
language foes in QuickEntry window fzurell OmniFocus 1 for Mac 0 2011-11-29 03:03 AM
create new project in quickentry reimannje OmniFocus for iPad 5 2011-10-06 11:59 PM
Finally, Standalone QuickEntry and More! (Anxiety + OmniFocus) devn OmniFocus Extras 3 2008-09-28 06:19 PM
Creating Nested Projects from QuickEntry Saaby OmniFocus 1 for Mac 4 2008-08-11 09:58 AM
Something Dumb I'm doing - quickentry window question filmgeek OmniFocus 1 for Mac 3 2007-10-09 07:48 PM


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


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