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

 
Reveal Script (switch alternative) Thread Tools Search this Thread Display Modes
It is fixed. Thanks!
Love it— this is an essential script.
 
At this line:

Code:
set t to leaf id pi -- this errors if focus is on, (OF bug?)
I get the error:

Code:
Can't get leaf id "____" of library of sidebar of document
window id -1 of document id "_____".
Anyone else? Any thoughts?

Thanks,
Eric
 
The problem seems to be that Alex is trying to use "pi" as a variable name.

Code:
set pi to id of P
set t to leaf id pi -- this errors if focus is on, (OF bug?)
As it happens "pi" is an Applescript constant with a value a little over 3.14 ...
 
even with
Code:
set pident to id of P
set t to leaf id pident -- this errors if focus is on, (OF bug?)
it still has the same problem (plus, I'd expect a lot more people than me to have the problem if the PI const was the issue). Good point / catch, though.
 
I wonder what "if focus is on" means
 
Something less sophisticated that may serve as a stop-gap in the meanwhile. In addition to tasks in project and context views, should also work for inbox tasks that have an assigned project.

Code:
tell application "OmniFocus"
	tell window 1
		try
			set lstTrees to selected trees of content
		on error
			return
		end try
		if (count of lstTrees) > 0 then
			set oValue to value of item 1 of lstTrees
			if class of oValue = task then
				set idTask to id of oValue
				set oProj to containing project of oValue
				tell front document of application "OmniFocus"
					set winFocus to make new document window with properties ¬
						{selected view mode identifier:"project", search term:""}
				end tell
				tell winFocus
					set focus to {oProj}
					my Expand(item 1 of trees of content)
					tell content
						select leaf id idTask
					end tell
				end tell
			else if class of oValue = inbox task then
				set idTask to id of oValue
				set oProj to assigned container of oValue
				if class of oProj = project then
					tell front document of application "OmniFocus"
						set winFocus to make new document window with properties ¬
							{selected view mode identifier:"project", search term:"", focus:{oProj}}
					end tell
					tell winFocus
						tell sidebar
							select every leaf
						end tell
						tell content
							select leaf id idTask
						end tell
						my Expand(last item of trees of content)
					end tell
				end if
			end if
		end if
	end tell
end tell


on Expand(oTree)
	using terms from application "OmniFocus"
		set oSubTrees to trees of oTree
		
		if (count of oSubTrees) > 0 then
			set expanded of oTree to true
			repeat with oSubTree in oSubTrees
				Expand(oSubTree, true)
			end repeat
		end if
	end using terms from
end Expand

Last edited by RobTrew; 2008-03-08 at 07:31 AM.. Reason: Update code
 
Quote:
Originally Posted by curt.clifton View Post
Just the usual Applescript dictionary, available from File --> Open Dictionary in Script Editor. There are lots of open-source scripts floating around also. My collection is available here. (I'll be revving a bunch of those soon, as many of my scripts suffered from the same problem as Alex's Reveal script.)
anther way to get the dictionary is to have script editor open or the icon in sight and drag your application into it ===

Script editor will open up the dictionary for that program (and the standard dictionary)
 
Please try version 2.05ß which I have uploaded. This version is greatly cleaned up from previous versions, and doesn't even contain the code you mention!

Let me know how you get on.
 
I'm getting "You have selected something that isn't an action" with the beta, when launched from the toolbar.

edit: Two "Reveal" scripts are listed in my scripts menu - the first yields the same error, the second works.

edit 2: If I put the "Main" script in my toolbar and launch it, that works.

Last edited by Craig; 2008-03-10 at 08:15 AM..
 
Hi Craig,

Firstly, yeah, sorry, this is a beta, I can explain, and there's something I'd like you to try.

In order to 'fix' some horribleness with losing icons and version control, I am now using a script bundle. Script bundles are not perfectly supported by Omnifocus.

Since script bundles have a different extension (scptd) to simple compiled scripts (scpt), This means the new version you have installed does not replace the old version 1 reveal script. Please look in ~/Library/Scripts/Applications/Omnifocus. You should see 2 scripts called Reveal. You can use Show Info to see their full filenames - Reveal.scpt and Reveal.scptd.

For the moment, please rename Reveal.scpt to Reveal1.scpt.

When you restart omnifocus you should see 3 scripts in the customise toolbar view: Reveal1, Reveal and main.

I expect that Reveal (the new one) and main (the works inside the new one) will operate correctly, and the same as each other. Please let me know if that doesn't work. If it does work, please delete (or backup and delete) Reveal1.scpt and just ignore the script 'main'.

Thanks for trying out my beta software!
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Icon alternative francola OmniFocus 1 for Mac 14 2010-05-25 03:23 PM
Feature Request: Reveal Command gcrump OmniFocus for iPhone 0 2008-09-03 10:47 AM
Alternative to due dates ptone OmniFocus 1 for Mac 2 2008-08-16 08:46 PM
Alternative Sync joelande OmniFocus 1 for Mac 0 2007-06-01 04:59 PM


All times are GMT -8. The time now is 11:44 PM.


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