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.
(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