The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus 1 for Mac (http://forums.omnigroup.com/forumdisplay.php?f=38)
-   -   View the location of an OF context in Google Earth (http://forums.omnigroup.com/showthread.php?t=19078)

RobTrew 2010-11-25 08:01 AM

View the location of an OF context in Google Earth
 
To go with the location-setting script in [URL="http://forums.omnigroup.com/showthread.php?t=19072"]another thread[/URL] 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[/CODE]


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

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