The launch command

Ian Wood revlist at azurevision.co.uk
Wed Feb 27 03:59:31 EST 2008


On 26 Feb 2008, at 22:36, Richard Holton Pierce wrote:

> and I am trying to make a handler that will launch Google Earth from  
> within my stack and then paste a set of coordinates into Google's  
> search field.

I think you're going about this in a much harder way than needed.  
Google Earth is directly scriptable via AppleScript (with a few quirks).

Stick the following in a field or custom property:

tell application "Google Earth"
	set tPos to GetViewInfo
	set latitude of tPos to tLat
	set longitude of tPos to tLong
	set distance of tPos to tDist
	SetViewInfo tPos speed tSpeed
end tell

Then use the following function:

function ijwGELib_setView tLat tLong tDist tSpeed
   if tSpeed is empty then put 0.5 into tSpeed
   put text of fld "setView" of card "applescripts" of stack  
"GoogleEarthLib" into tScript -- replace this with the location of  
your field or customprop
   replace "tLat" with tLat in tScript
   replace "tLong" with tLong in tScript
   replace "tDist" with tDist in tScript
   replace "tSpeed" with tSpeed in tScript
   do tScript as applescript
   return the result
end ijwGELib_setView

The following should get you started on retrieving information from  
GE, but note that you can't currently get Altitude. :-(

on getGPSfromGE
   put "tell application" && quote & "Google Earth" & quote & return &  
"copy (GetViewInfo) to tInfo" & return & "get latitude of tInfo" &  
return & "end tell" into tScript
   do tScript as applescript
   put round(the result,5) into fld "latitude"
   put "tell application" && quote & "Google Earth" & quote & return &  
"copy (GetViewInfo) to tInfo" & return & "get longitude of tInfo" &  
return & "end tell" into tScript
   do tScript as applescript
   put 0 - round(the result,5) into fld "longitude"
   put 0 into fld "altitude"
end getGPSfromGE

Ian

P.S. Richard - it would be either a KML or more likely KMZ file, as  
you say this would then be cross-platform.



More information about the use-livecode mailing list