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

 
Selecting item in quick entry Thread Tools Search this Thread Display Modes
I was writing a script that could be used as a PDF Service to add a corresponding task in OmniFocus. The main difference from other similar scripts is that it shows up in Quick Entry so I can add more information to the task.

I got most of the way fine, but ran into some issues with OmniFocus's selection model. Is there a better way to get from an item to a leaf?

This is what I've got right now, with a comment showing where I tried something that seemed more reasonable (but which didn't work):

Code:
on open _items
	local _item, _name, _task
	repeat with _item in (_items as list)
		tell application "System Events"
			set _name to _item's name
			get _item's name extension
			if (result ≠ "") then -- strip extension
				set _name to (characters 1 thru ((count _name's characters) - (count result's characters) - 1) of _name) as string
			end if
		end tell
		
		tell application "OmniFocus"
			tell front document's quick entry
				open
				set _task to (make inbox task with properties {name:_name})
				tell _task's note to make new file attachment with properties ¨
					{file name:_item's POSIX path, embedded:true}
				get _task's id
				-- get leaves whose id is result
				-- error "Canít get id whose it = \"m75YwCmFP4l\". Access not allowed." number -1723
				repeat with _leaf in leaves
					if _leaf's id is result then
						select _leaf
						exit repeat
					end if
				end repeat
			end tell
			activate
		end tell
	end repeat
end open
 
Try this as your inner bit:
Code:
	tell front document's quick entry
		open
		set _task to (make inbox task with properties {name:_name})
		tell _task's note to make new file attachment with properties ¨
			{file name:_item's POSIX path, embedded:true}
		select (leaves whose id is _task's id)
	end tell
 
Quote:
Originally Posted by whpalmer4 View Post
Try this as your inner bit:
Code:
	tell front document's quick entry
		open
		set _task to (make inbox task with properties {name:_name})
		tell _task's note to make new file attachment with properties ¨
			{file name:_item's POSIX path, embedded:true}
		select (leaves whose id is _task's id)
	end tell
Perfect, thanks.
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick export from OO outline item to OF task schakwin OmniOutliner 3 for Mac 1 2013-04-13 01:17 PM
Quick entry mikegibb OmniFocus for iPad 2 2010-08-22 03:00 AM
Keyboard shortcut for selecting an item from a list yogarama OmniOutliner 3 for Mac 1 2008-07-17 09:20 AM
OmniWeb-5.6-v613 selecting item from drop-down page element benanzo OmniWeb Bug Reports 1 2008-01-19 05:11 AM
[req] Quick entry + menubar item w/o OF running justG OmniFocus 1 for Mac 8 2007-12-16 03:06 PM


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


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