Vater und Sohn
Geomaster
und wenn nicht...dann hier: http://gsak.net/Macros.phpHHL schrieb:das ist alles im installpaket mit drin.blondie schrieb:und wo bekomme ich das macro her?
happy downloading.
oder hier:
Code:
# -------------------------------------------------------------------------
# Version 1.1 - January 2006
# -------------------------------------------------------------------------
# History of changes:
# 1.1: added choice of waypoint identification
# 1.0: initial release
# -------------------------------------------------------------------------
debug status="off"
vsub status="on"
# determine path of export file and make sure that folder exists
$outPath = $_Install + "\exports"
$BatFile = $_Install + "\babel.bat"
If .not. FolderExists($outPath)
$result = PutFile($BatFile, "MD " + quote($outPath))
FileOpen File="$BatFile" Wait=yes
EndIf
$outFile = "$outPath\gsak.kml"
# regexp used to determine valid characters in cacheName
# if you choose to have the cache name cleaned by GSAK, only those valid characters will remain
# \w any alphanumeric character, including _
# \s any space
# \x21-\x25, \x27-\x2E any character between chr(33) and chr(46) (numbers, round brackets, calculation symbols (except / ),...)
# \x26 is excluded from the valid characters, it's the & symbol
# \xBA-\xFF any character between chr(186) and chr(255) (accented and special chars)
$validchars = "[°€{}\w\s\x21-\x25\x27-\x2E\xBA-\xFF]*"
# sort db on cache type (in order to create a folder per cache type)
sort by="cachetype"
goto position=top
# ask how to output the cache names
choose msg="Choose waypoint identification" opt1="GCxxxx" opt2="Waypoint Name" opt3="Smart Name"
$id = "$result"
# write head of output file
$res = PutFile($outFile,$header)
$previousCacheType = "-"
$totalRecordCount = $_Count
$currentRecordCount = 1
while .not. $_EOL
$msg = "Processing record $currentRecordCount of $totalRecordCount..."
ShowStatus msg="$msg"
$currentRecordCount = $currentRecordCount + 1
# determine cache type and prepare folder name and icon number
$icon = 8
$currectCacheType = "Other"
if $d_CacheType = "B"
$icon = 5
$currectCacheType = "Letterbox"
endif
if $d_CacheType = "C"
$icon = 13
$currectCacheType = "Cache In Trash Out"
endif
if $d_CacheType = "E"
$icon = 6
$currectCacheType = "Event"
endif
if $d_CacheType = "G"
$icon = 8
$currectCacheType = "Benchmark"
endif
if $d_CacheType = "L"
$icon = 4
$currectCacheType = "Locationless"
endif
if $d_CacheType = "M"
$icon = 3
$currectCacheType = "Multi"
endif
if $d_CacheType = "O"
$icon = 8
$currectCacheType = "Other"
endif
if $d_CacheType = "R"
$icon = 8
$currectCacheType = "Earth"
endif
if $d_CacheType = "T"
$icon = 2
$currectCacheType = "Traditional"
endif
if $d_CacheType = "U"
$icon = 8
$currectCacheType = "Unknown"
endif
if $d_CacheType = "V"
$icon = 4
$currectCacheType = "Virtual"
endif
if $d_CacheType = "W"
$icon = 11
$currectCacheType = "Webcam"
endif
# is this the first cache of a new type (traditional, multi,...)
if $previousCacheType <> $currectCacheType
# close previous folder (unless this is the first folder in the output file)
if $previousCacheType <> "-"
$res = AppendFile($outFile,$endOfFolder)
endif
# create the new folder
$Folder = replace("[FOLDER]",$currectCacheType,"<Folder><name>[FOLDER]</name>",true)
$res = AppendFile($outFile,$Folder)
endif
$previousCacheType = $currectCacheType
$body = $bodyTemplate
$ident = $d_Code
if $id = "2"
$ident =$d_Name
endif
if $id = "3"
$ident =$d_SmartName
endif
#clean up the cache identification by removing invalid characters
$count = RegExCount($validChars, $ident)
$cleaned = ""
$x = 1
while $x <= $count
$good = RegExData($validChars,$ident,$x)
$cleaned = $cleaned + $good
$x = $x + 1
endwhile
$ident = $cleaned
$body = replace("[IDENT]",$ident,$body,true)
$body = replace("[ICON]","$icon",$body,true)
$cacheName = $d_Name
$placedBy = $d_PlacedBy
$diff = $d_Difficulty
$terrain = $d_Terrain
#clean up the cache name by removing invalid characters
$count = RegExCount($validChars, $cacheName)
$cleaned = ""
$x = 1
while $x <= $count
$good = RegExData($validChars,$cacheName,$x)
$cleaned = $cleaned + $good
$x = $x + 1
endwhile
$cacheName = $cleaned
#clean the name of the owner by removing invalid characters
$count = RegExCount($validChars, $placedBy)
$cleaned = ""
$x = 1
while $x <= $count
$good = RegExData($validChars,$placedBy,$x)
$cleaned = $cleaned + $good
$x = $x + 1
endwhile
$placedBy = $cleaned
$body = replace("[DESCRIPTION]", "$cacheName", $body,true)
$body = replace("[TYPE]", "$currectCacheType", $body,true)
$body = replace("[PLACEDBY]", "$placedBy", $body,true)
$body = replace("[DIFF]", "$diff", $body,true)
$body = replace("[TERRAIN]", "$terrain",$body,true)
$y = $d_Latitude
$body = replace("[LAT]","$y",$body,true)
$y = $d_Longitude
$body = replace("[LON]","$y",$body,true)
$res = AppendFile($outFile,$body)
goto position="next"
endwhile
ShowStatus msg="Finished processing $totalRecordCount records."
# write the tail of the file
$res = AppendFile($outFile,$footer)
sort by="description"
goto position="top"
$msg = $outFile + $launchGoogle
input msg="$msg" default="Y"
if upper($result) = "Y"
openfile file=$outFile
endif
#-----------------------------------------------------------------------
<data> varname=$header
<?xml version="1.0" encoding="ISO-8859-1"?>
<kml creator="GSAK Google Earth Creator" xmlns="http://earth.google.com/kml/2.0">
<Folder>
<name>GSAK</name>
<visibility>1</visibility>
<enddata>
<data> varname=$footer
</Folder>
</Folder>
</kml>
<enddata>
<data> varname=$bodyTemplate
<Placemark>
<name>[IDENT]</name>
<styleUrl>defaultStyle</styleUrl>
<Style><IconStyle><Icon><href>http://www.geocaching.com/images/kml/[ICON].png</href></Icon></IconStyle></Style>
<description><![CDATA[<a href='http://www.geocaching.com/seek/cache_details.aspx?wp=[GCCODE]'>[DESCRIPTION]</a>, [TYPE] ([DIFF]/[TERRAIN]) by [PLACEDBY]]]></description>
<Point><coordinates>[LON], [LAT]</coordinates></Point>
</Placemark>
<enddata>
<data> varname=$endOfFolder
</Folder>
<enddata>
<data> varname=$launchGoogle
has been created.
Do you want to launch Google Earth and open your file?
Please enter: (Y)es or (N)o
<enddata>