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

Frage zu eigenem Makro

wurschtbrot

Geocacher
Moin!

Hab keine Ahnung vom programmieren und daher ein Makro leicht modifiziert, mit dem ich die Caches einer geplanten Tour als einzelne VCF-Dateien auf eine SD-Karte exportieren kann, um diese im Auto auf dem RNS 510 (VW) anzeigen zu können. Alles funktioniert ganz annehmbar aber noch nicht perfekt.

Meine Fragen zum Code wären:
- Wie kann ich einen Speicherort wählen? Die Dateien sollten im Optimalfall auf der SD-Karte in einem Unterordner "/destinations" abgelegt werden.
- Wie schalte ich die Namensabfage ("Namen vor dem GC-Code eingeben") ab? Mir reicht das Format $d_code + " - " + $d_name vollkommen, brauche keinen $text davor und eben auch nicht die Abfrage # get the file name to put the CSV file out to.

Vielen, herzlichen Dank für Lösungshinweise!
wurschtbrot

Hier das Makro:
Code:
#*******************************************
# MacVersion = 1.0
# MacDescription = VCF für RNS 510
# MacAuthor = wurschtbrot
# MacFileName = vcf2rns.gsk
# MacUrl = 
#*******************************************

#Debug Status=on
$vcard="BEGIN:VCARD\nVERSION:3.0\nCATEGORIES:VIP\nX-VIPCategory:Misc\nADR;ENCODING=QUOTED-PRINTABLE:;;;;;;\nX-NAVADDR:;;;;;;;;;\nGEO:!lat!;!long!\nX-Flag:\nREV:20111216T144548z\nFN;ENCODING=QUOTED-PRINTABLE:!name!\nUID:AddresBookPersistentProvider3\nEND:VCARD\n"

# get the file name to save folder from saved settings if file exists 
If FileExists($_Install + "\Macros\NavMan.dat")
  Set $File = GetFile($_Install + "\Macros\NavMan.dat")
  # Just in case file permission error or something test for error
  IF Left($File,7) = "*Error*"
    Pause Msg="$File"
    Cancel
  EndIf 
else
  Set $File = " "
EndIf

# get the file name to put the CSV file out to.
$Result = 2
While $Result = 2
  Input Msg="Namen vor dem GC-Code eingeben"  Default=$File VarName=$File Browse="File"
  If FileExists($File)
    Choose msg="File already exists. Overwrite?" opt1=Yes opt2=No
    If $Result = 1
      FileErase File=$file 
    EndIf  
  Else
    $Result = 1
  EndIf    
EndWhile

# Save the file name so don't have to key if same next time
Set $error = PutFile($_Install + "\Macros\tiguan.dat",$File)  
# Just in case file permission error or something test for error
IF Left($Error,7) = "*Error*"
  Pause Msg="$Error"
  Cancel
EndIf   
Set $ThisRecord = 0
Set $NumberFound = 0
Set $NumberPics = 0
Goto Position=Top

# now loop through the current subset to generate the csv file
While .not. $_EOL
  # set up totals to show status to user
  Set $ThisRecord = $ThisRecord + 1
  Set $status = "Now processing: " + "$ThisRecord" + " of " + "$_Count"
  ShowStatus msg="$status"
  $text=RegExReplace("!lat!",$vcard,$d_Latitude)
  $text=RegExReplace("!long!",$text,$d_Longitude)
  $text=RegExReplace("!name!",$text,$d_code + " - " + $d_name)
# correct linebreaks
  $text = Replace("\n",chr(13)+chr(10),$text)
  $Data = PutFile($d_code+$file+".vcf",$text)
  # Just in case file permission error or something test for error
  IF Left($data,7) = "*Error*"
    Pause Msg=$result
    Cancel
  EndIf  
  Goto Position=Next
EndWhile
GoTo Position=Top
 
Oben