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 1 for Mac
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
View the location of an OF context in Google Earth Thread Tools Search this Thread Display Modes
To go with the location-setting script in another thread this one allows you to view the location of a selected OF context in Google Earth.

(A way of checking that you have set the right latitude and longitude. The view will be centred on coordinates specified in the context's location.)

Select a context in OF and run this script.

Code:
property pTitle : "Show location of selected OF context in Google Earth"
property pVer : "0.03"
property pDistance : 150 -- edit the preferred height above the location here (metres)


tell application id "OFOC"
	set oDoc to front document
	tell front document window of oDoc
		set lstContexts to value of selected trees of sidebar
		if length of lstContexts < 1 or class of first item of lstContexts ≠ context then
			display dialog "Select a context in OmniFocus before running this script" buttons {"OK"} with title pTitle
			return
		end if
	end tell
	
	set oContext to first item of lstContexts
	set oLocn to location of oContext
	if oLocn is missing value then
		display dialog "No location is assigned to the context:" & return & return & ¬
			name of oContext buttons {"OK"} with title pTitle
		return
	else
		try
			set {numLat, numLong} to {latitude, longitude} of oLocn
		on error
			set strName to name of oLocn
			display dialog "No latitude or longitude is assigned to the location " & strName & return & return & ¬
				"for context: " & name of oContext buttons {"OK"} with title pTitle
			return
		end try
	end if
end tell


tell application id "Erth"
	activate
	SetViewInfo {latitude:numLat, longitude:numLong, distance:pDistance, tilt:0.0, azimuth:0}
end tell

Last edited by RobTrew; 2012-04-06 at 10:08 AM.. Reason: Added error checking in case of Search locations - thanks to whpalmer4 for drawing my attention to these
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Search-based location contexts stopped working? [A: Google changed results they send; fix incoming.] jdgonzalez OmniFocus for iPhone 9 2012-09-06 09:16 AM
Hiding contexts not relevant to my location in context view jag OmniFocus for iPad 4 2010-10-09 08:42 PM
How to view task due dates in Context View, when you've scheduled the whole project bak OmniFocus 1 for Mac 3 2009-11-10 08:14 AM
Context location editing in OF? ahallam OmniFocus 1 for Mac 5 2009-02-05 03:37 PM
paste location outside view mrzizzy OmniGraffle General 0 2006-07-24 11:11 AM


All times are GMT -8. The time now is 01:18 PM.


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