• Willkommen im Geoclub - dem größten deutschsprachigen Geocaching-Forum. Registriere dich kostenlos, um alle Inhalte zu sehen und neue Beiträge zu erstellen.

Das Programm GSAK

Vater und Sohn

Geomaster
HHL schrieb:
blondie schrieb:
und wo bekomme ich das macro her?
das ist alles im installpaket mit drin.

happy downloading.
und wenn nicht...dann hier: http://gsak.net/Macros.php

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>
 

Dragon-Cacher

Geocacher
Hi Jürgen,

Jurgen & co schrieb:
Was ist der name von diese macro?

offensichtlich ist heute ne neue Version rausgekommen.
Sie trägt den Namen "GoogleEarth-v1.5.zip", ganz unten.

Die "alte" Version nannte sich nur "ge.txt" und bei der klappte es bei mir nicht in GoogleEarth den Cache durch anklicken aufzurufen. Als Parameter in der URL wurden keine WayPointNamen übergeben, mal schauen ob das mit der jetzigen Version behoben wurde...

Viele Grüße
Mathias :wink:
 

Vater und Sohn

Geomaster
Dragon-Cacher schrieb:
Die "alte" Version nannte sich nur "ge.txt" und bei der klappte es bei mir nicht in GoogleEarth den Cache durch anklicken aufzurufen. Als Parameter in der URL wurden keine WayPointNamen übergeben, mal schauen ob das mit der jetzigen Version behoben wurde...

Es geht - sehr gut sogar :D
 

Black-Jack-Team

Geomaster
Das neue Makro ge.txt aus Version 1.5 muss normalerweise für deutsche Verhältnisse editiert werden:
Die Zeile
Code:
$iconPath = "C:/Program Files/Google/Google Earth/res/geocaching.png"
muss editiert werden in (bei mir):
Code:
$iconPath = "C:/Programme/Google/Google Earth/res/geocaching.png"
Also aus "Program Files" "Programme" machen.
 
Oben