#******************************************* # MacVersion = 3.3 # MacDescription = Memory Map / PDA export # MacAuthor = PopUpPirate # MacFileName = PUP Port #******************************************* ############################################################################################################################## # http://www.nwcaching.co.uk/forum for support ############################################################################################################################## ############################################################################################################################## # Version and location check ############################################################################################################################## $pupversion="33" #Legacy routine to check where PP is installed... doesn't really matter now, but left in for this version just in case. #IF FileExists("C:\gsak\gsak.exe") #ELSE #MsgOk Msg=Sorry, this version of PUP-Port requires that you install GSAK to C:\GSAK. Caption=Sorry! #CANCEL #ENDIF IF left($_Version,3)>"7.4" ELSE MsgOk Msg=Sorry, PUP-Port requires GSAK version 7.5 or higher. Caption=Sorry! CANCEL ENDIF ############################################################################################################################## # Check if the dialog.txt file exists, if not, run the FirstRun subroutine ############################################################################################################################## IF FileExists($_ExePath + "\Pup\pup.ini") SET $settings = GetFile($_ExePath + "\Pup\pup.ini") ELSE GOSUB Name=FirstRun ENDIF # $settings is the contents of the pup.ini file. It stores the status of the dialogue box (form), for instance, whether "Export to PDA" is ticked, etc. # Memory Map;PDA;labels;web;storage card name;iconname;linktodevice;linktonet;version SET $MM = Extract($settings, ";", 1) SET $PDA = Extract($settings, ";", 2) SET $labels = Extract($settings, ";", 3) SET $web = Extract($settings, ";", 4) SET $storage = Extract($settings, ";", 5) SET $labname = Extract($settings, ";", 6) SET $device = Extract($settings, ";", 7) SET $net = Extract($settings, ";", 8) # We don't read $pupversion because this macro *always tells* the file what version we are on, and not the other way around. #Let's remove any slashes from the Storage Card path... we can always add 'em back in later, and we shall! $storage = ALLTRIM ($storage) #Gets your GC.com ID, providing you've entered it in GSAK's settings/options. SET $myid = Sysinfo("gsakini;TfmConfig;EdtGeoName.Text") # Call the sub to convert all them variables to Booleans that the FORM likes. GOSUB Name=Preform # Then edit the form to see what should be greyed out. GOSUB Name=Enabled ############################################################################################################################## # Here's where the form (dialogue box) kicks in! ############################################################################################################################## While True $exit = Form($form,"") #If we click the "X" then exit the form IF $exit = "SystemExit" Cancel ENDIF # If we click OK, then Break out of the loop (and don't therefore redisplay the form) IF $exit = "OK" Break ENDIF # Otherwise, we must have clicked something else, so let's check if we need to redisplay the form, after (un)greying some choices. GOSUB Name=Enabled Endwhile # And convert all those Booleans back to strings... just how PUP.INI likes. GOSUB Name=Postform ############################################################################################################################## # Gets your user ID, then pops it into the MYID variable. Then combines 3 variables to give the GSAX MYEXPORT.XSL file # The $labels variable is set in the dialogue box, dependent on whether you tick the Labels box or not. ############################################################################################################################## #We removed any slashes at the start and end of the Storage Card path. This is where we add one back in at the end, but only if NOT copying to the device root, cos a / would confuse matters. $prestorage="\" IF len($storage)>0 $locale=$storage+"\" ENDIF #Correct all paths. The original export was for an installation to C:\gsak, so let's find and replace all these instances with the actual location. $gsak="c:\gsak" $ppxsl2 = Replace($gsak,$_ExePath,$ppxsl2) $GPXstart = Replace($gsak,$_ExePath,$GPXstart) $HT = Replace($gsak,$_ExePath,$HT) # Sort the csv.xsl to link to t'interweb, if we've told it to do so. IF $net = "1" $prestorage="" $locale=$weblink $ppxslnextbit="" ENDIF # Writes the code for labels IF $labels = "1" SET $fullcsvxsl = $ppxsl1+$myid+$ppxsl2+$prestorage+$locale+$ppxslnextbit+$ppxslabelson+$ppxsl3 ENDIF IF $labels = "0" SET $fullcsvxsl = $ppxsl1+$myid+$ppxsl2+$prestorage+$locale+$ppxslnextbit+$ppxslabelsoff+$ppxsl3 ENDIF SET $data=PutFile($_ExePath + "\Pup\myexport.xsl",$fullcsvxsl) ############################################################################################################################## # Check to see that there's not too many waypoints to process. If there are over 1000, it will ask if you are sure. ############################################################################################################################## IF $_Count > 1000 PAUSE Msg="Over 1000 Waypoints selected! Are you sure you want to continue?" endif ############################################################################################################################## # This is the Memory Map export ############################################################################################################################## IF $MM = "1" $CustomB="edtBabelOut.Text=" + $_ExePath + "\msxsl" +" " + $_Quote + $_ExePath + "\Pup\babel.gpx" + $_Quote +" " + $_Quote + $_ExePath + "\Pup\myexport.xsl"+$_Quote + " -o " + $_ExePath + "\Pup\geocache.csv" $Custom=$CustomA+$CustomB+$CustomC $GPX=$GPXstart + "edtFormat.Text=" + $labname + $GPXend MacroSet dialog=GPX VarName=$GPX Export Type=GPX Settings= MacroSet dialog=Custom VarName=$Custom Export Type=Cus Settings= RUNPGM PGM="C:\Program Files\Memory-Map\OS-5\MMNav.exe" PARMS="$_ExePath\Pup\geocache.csv" ENDIF ############################################################################################################################## # This is the PDA export ############################################################################################################################## IF $PDA = "1" MacroSet dialog=HTML VarName=$HT Export Type=HTML Settings= $shortpath=right($_ExePath,(len($_ExePath))-3) $cecopymid="cecopy /s "+ $_Quote + "desk:\"+$shortpath+"\Pup\HTML\*.*"+ $_Quote + " "+ $_Quote + "dev:\" $cecopymid=$cecopymid+$storage+"""" $cecopier=$cecopystart+$cecopymid+$cecopyend SET $data=PutFile($_ExePath + "\Pup\mobilecopy.bat",$cecopier) RUNPGM PGM="$_ExePath\Pup\mobilecopy.bat" ENDIF ############################################################################################################################## # Write dialog box settings ############################################################################################################################## $settings=$MM+";"+$PDA+";"+$labels+";"+$web+";"+$storage+";"+$labname+";"+$device+";"+$net+";"+$pupversion SET $data=PutFile($_ExePath + "\Pup\pup.ini",$settings) ############################################################################################################################## # SUB - We've got the data out of PUP.INI and set all the variables, however, the FORM needs Boolean, so we'll convert it all. ############################################################################################################################## BeginSub Name=Preform IF $MM="1" $dialMM=True ELSE $dialMM=False ENDIF IF $PDA="1" $dialPDA=True ELSE $dialPDA=False ENDIF IF $labels="1" $diallabels=True ELSE $diallabels=False ENDIF IF $web="1" $dialweb=True ELSE $dialweb=False ENDIF IF $device="1" $dialdevice=True $dialnet=False ELSE $dialdevice=False $dialnet=True ENDIF EndSub ############################################################################################################################## # SUB - Greying and ungreying shenanigans. ############################################################################################################################## BeginSub Name=Enabled IF $dialMM=True $Form = EditForm($Form,"Label9","Enabled","Yes") $Form = EditForm($Form,"labname","Enabled","Yes") $Form = EditForm($Form,"diallabels","Enabled","Yes") $Form = EditForm($Form,"Label4","Enabled","Yes") $Form = EditForm($Form,"Label10","Enabled","Yes") $Form = EditForm($Form,"dialnet","Enabled","Yes") $Form = EditForm($Form,"dialdevice","Enabled","Yes") ENDIF IF $diallabels=False $Form = EditForm($Form,"Label9","Enabled","No") $Form = EditForm($Form,"labname","Enabled","No") ENDIF IF $diallabels=True $Form = EditForm($Form,"Label9","Enabled","Yes") $Form = EditForm($Form,"labname","Enabled","Yes") ENDIF IF $dialMM=False $Form = EditForm($Form,"Label9","Enabled","No") $Form = EditForm($Form,"labname","Enabled","No") $Form = EditForm($Form,"diallabels","Enabled","No") $Form = EditForm($Form,"Label4","Enabled","No") $Form = EditForm($Form,"Label10","Enabled","No") $Form = EditForm($Form,"dialnet","Enabled","No") $Form = EditForm($Form,"dialdevice","Enabled","No") ENDIF IF $dialPDA=True $Form = EditForm($Form,"Label5","Enabled","Yes") $Form = EditForm($Form,"storage","Enabled","Yes") $Form = EditForm($Form,"Label6","Enabled","Yes") ENDIF IF $dialPDA=False $Form = EditForm($Form,"Label5","Enabled","No") $Form = EditForm($Form,"storage","Enabled","No") $Form = EditForm($Form,"Label6","Enabled","No") ENDIF EndSub ############################################################################################################################## # SUB - The forms filled in - lets convert those settings from Booleans to strings. ############################################################################################################################## BeginSub Name=Postform IF $dialMM=True $MM="1" ELSE $MM="0" ENDIF IF $dialPDA=True $PDA="1" ELSE $PDA="0" ENDIF IF $diallabels=True $labels="1" ELSE $labels="0" ENDIF IF $dialweb=True $web="1" ELSE $web="0" ENDIF IF $dialdevice=True $device="1" $net="0" ELSE $device="0" $net="1" ENDIF EndSub ############################################################################################################################## # First time run subroutine ############################################################################################################################## # Memory Map;PDA;labels;web;storage card name;iconname;linktodevice;linktonet BeginSub Name=FirstRun VSUB STATUS=OFF SET $settings = "0;0;0;0;Storage Card;%drop2 %name;1;0" VSUB STATUS=ON # Download batch file to create directories, seeing as GSAK (un)zip function doesn't handle folders $data = GetUrl("http://www.nwcaching.co.uk/pupdir.bat","Getting data") $status = putfile($_ExePath + "\Macros\pupdir.bat",$data) RUNPGM PGM=$_ExePath + "\Macros\pupdir.bat" # Download and unzip to each folder - icons and other files. Check 'em out! $data = GetUrl("http://www.nwcaching.co.uk/puppup.zip","Getting data") $status = putfile($_ExePath + "\Macros\puppup.zip",$data) $Status = ZipFile("unzip",$_ExePath + "\Macros\puppup.zip",$_ExePath + "\Pup") $data = GetUrl("http://www.nwcaching.co.uk/pupmac.zip","Getting data") $status = putfile($_ExePath + "\Macros\pupmac.zip",$data) $Status = ZipFile("unzip",$_ExePath + "\Macros\pupmac.zip",$_ExePath + "\Macros") $data = GetUrl("http://www.nwcaching.co.uk/pupico.zip","Getting data") $status = putfile($_ExePath + "\Macros\pupico.zip",$data) $Status = ZipFile("unzip",$_ExePath + "\Macros\pupico.zip",$_ExePath + "\ICONS") $data = GetUrl("http://www.nwcaching.co.uk/pupconv.zip","Getting data") $status = putfile($_ExePath + "\Macros\pupconv.zip",$data) $Status = ZipFile("unzip",$_ExePath + "\Macros\pupconv.zip",$_ExePath) EndSub ############################################################################################################################## # Dialog box settings ############################################################################################################################## VarName=$GPXstart [TfmExportGpx] fnmTo.Text=C:\gsak\Pup\babel.gpx cbxLimit.Text=0 cbxUserNotes.Checked=True chkActual.Checked=False chkDefault.Checked=False chkExtra.Checked=True chkMyLogs.Checked=False chkSymbol.Checked=False VarName=$GPXend edtMax.Text= edtMaxGps.Text=15 edtWaypoint.Text=%code rbtGpx.Checked=True rbtLoc.Checked=False edtProblem.Text='"?[] edtExtra.Text= chkChild.Checked=True chkOnlyChild.Checked=False rbtAllChildren.Checked=True rbtOnlyFlagged.Checked=False rbtOnlyUnFlagged.Checked=False chkApplyName.Checked=False chkForce.Checked=True cbxVersion.Text=Ver 1.0 [TfmExportGpx.cbxRecent.Items] Count=1 VarName=$CustomA [TfmBabel2] VarName=$CustomC chkDebug.Checked=True chkYes.Checked=False cbxGPX.Text=... Last active VarName=$HT [TfmHtml.strChecked.Strings] Count=1 Item0=_MWW 2,51.364917 ,-1.16375 [TfmHtml] cbxHtmlFound.Checked=True cbxHtmlPlaced.Checked=True cbxIndex.Checked=True cbxLimit.Text=0 cbxLogLimit.Text=5 cbxMakeZip.Checked=False cbxUseOwnerId.Checked=True chkBearing.Checked=True chkBugs.Checked=True chkCode.Checked=True chkCustomUrl.Checked=True chkCvtFile.Checked=False chkDefaultGeneral.Checked=True chkDefaultAdvanced.Checked=False chkDensity.Checked=True chkDistance.Checked=True chkFound.Checked=True chkFoundByMe.Checked=True chkName.Checked=True chkPlacedBy.Checked=True chkRemovePictures.Checked=True chkSpecial.Checked=False chkStrip.Checked=True chkTopOfPage.Checked=False chkUnfound.Checked=True edtCode.Text=%code edtDensity.Text=5 edtDisGroup.Text=20 edtHtmZip.Text=C:\gsak\cache\cache.zip edtMax.Text=40 edtSpecial.Text= edtHtmFolder.Text=C:\gsak\Pup\HTML cbxFormat.Text=GSAK Default chkDecodeHints.Checked=True chkGrab.Checked=False chkGrabFirst.Checked=False chkGoogleMap.Checked=False chkAddCache.Checked=True rbtHtml.Checked=False rbtHtm.Checked=True chkPdaFriendly.Checked=False edtfpf.Text=50 VarName=$cecopystart c: cd\ cd gsak cd Pup VarName=$cecopyend cd\ cd gsak cd Pup cd HTML cd cache del *.* /q ############################################################################################################################## # Here are the $ppxsl* variables, which together make up a new version of what was csv.xsl in ye olden days. ############################################################################################################################## VarName=$ppxsl1 VarName=$ppxsl2 IC01,101,"c:\gsak\icons\EventF.bmp" IC01,102,"c:\gsak\icons\LetterboxF.bmp" IC01,103,"c:\gsak\icons\LocationlessF.bmp" IC01,104,"c:\gsak\icons\MicroF.bmp" IC01,105,"c:\gsak\icons\MulticacheF.bmp" IC01,106,"c:\gsak\icons\TraditionalF.bmp" IC01,107,"c:\gsak\icons\UnknownF.bmp" IC01,108,"c:\gsak\icons\VirtualF.bmp" IC01,109,"c:\gsak\icons\WebcamF.bmp" IC01,110,"c:\gsak\icons\EarthF.bmp" IC01,111,"c:\gsak\icons\MM_F.bmp" IC01,112,"c:\gsak\icons\AR_F.bmp" IC01,113,"c:\gsak\icons\SidetF.bmp" IC01,114,"c:\gsak\icons\WhereigoF.bmp" IC01,115,"c:\gsak\icons\TrigF.bmp" IC01,116,"c:\gsak\icons\TrigpF.bmp" IC01,117,"c:\gsak\icons\HillF.bmp" IC01,201,"c:\gsak\icons\EventN.bmp" IC01,202,"c:\gsak\icons\LetterboxN.bmp" IC01,203,"c:\gsak\icons\LocationlessN.bmp" IC01,204,"c:\gsak\icons\MicroN.bmp" IC01,205,"c:\gsak\icons\MulticacheN.bmp" IC01,206,"c:\gsak\icons\TraditionalN.bmp" IC01,207,"c:\gsak\icons\UnknownN.bmp" IC01,208,"c:\gsak\icons\VirtualN.bmp" IC01,209,"c:\gsak\icons\WebcamN.bmp" IC01,210,"c:\gsak\icons\EarthN.bmp" IC01,211,"c:\gsak\icons\MM_N.bmp" IC01,212,"c:\gsak\icons\AR_N.bmp" IC01,213,"c:\gsak\icons\SidetN.bmp" IC01,214,"c:\gsak\icons\WhereigoN.bmp" IC01,215,"c:\gsak\icons\TrigN.bmp" IC01,216,"c:\gsak\icons\TrigpN.bmp" IC01,217,"c:\gsak\icons\HillN.bmp" IC01,301,"c:\gsak\icons\EventO.bmp" IC01,302,"c:\gsak\icons\LetterboxO.bmp" IC01,303,"c:\gsak\icons\LocationlessO.bmp" IC01,304,"c:\gsak\icons\MicroO.bmp" IC01,305,"c:\gsak\icons\MulticacheO.bmp" IC01,306,"c:\gsak\icons\TraditionalO.bmp" IC01,307,"c:\gsak\icons\UnknownO.bmp" IC01,308,"c:\gsak\icons\VirtualO.bmp" IC01,309,"c:\gsak\icons\WebcamO.bmp" IC01,310,"c:\gsak\icons\EarthO.bmp" IC01,311,"c:\gsak\icons\MM_O.bmp" IC01,312,"c:\gsak\icons\AR_O.bmp" IC01,313,"c:\gsak\icons\SidetO.bmp" IC01,314,"c:\gsak\icons\WhereigoO.bmp" IC01,315,"c:\gsak\icons\TrigO.bmp" IC01,316,"c:\gsak\icons\TrigpO.bmp" IC01,317,"c:\gsak\icons\HillO.bmp" IC01,401,"c:\gsak\icons\EventU.bmp" IC01,402,"c:\gsak\icons\LetterboxU.bmp" IC01,403,"c:\gsak\icons\LocationlessU.bmp" IC01,404,"c:\gsak\icons\MicroU.bmp" IC01,405,"c:\gsak\icons\MulticacheU.bmp" IC01,406,"c:\gsak\icons\TraditionalU.bmp" IC01,407,"c:\gsak\icons\UnknownU.bmp" IC01,408,"c:\gsak\icons\VirtualU.bmp" IC01,409,"c:\gsak\icons\WebcamU.bmp" IC01,410,"c:\gsak\icons\EarthU.bmp" IC01,411,"c:\gsak\icons\MM_U.bmp" IC01,412,"c:\gsak\icons\AR_U.bmp" IC01,413,"c:\gsak\icons\SidetU.bmp" IC01,414,"c:\gsak\icons\WhereigoU.bmp" IC01,415,"c:\gsak\icons\TrigU.bmp" IC01,416,"c:\gsak\icons\TrigpU.bmp" IC01,500,"c:\gsak\icons\Pint.bmp" IC01,900,"c:\gsak\icons\Parking.bmp" IC01,901,"c:\gsak\icons\Trail.bmp" WP04, , , 3 1 4 2 01 02 03 05 08 09 10 14 07 11 12 13 13 13 13 16 16 16 16 16 16 16 15 16 16 16 17 04 500 04 900 901 901 901 901 06 , " ", " by . . . D T ", " VarName=$ppxslnextbit Cache\ .htm VarName=$weblink http://www.geocaching.com/seek/cache_details.aspx?wp= VarName=$ppxslabelson ",0,0, VarName=$ppxslabelsoff ",0,1, VarName=$ppxsl3 ,1,1," Other Owned Found Unavailable Event LetterboxHybrid Locationless Multi Virtual WebCam Earth Wherigo Unknown Motorway Mayhem A-Road Anarchy Sidetracked Sidetracked Sidetracked Sidetracked Micro Pub Trig - Active Station Trig - Berntsen Trig - Block Trig - Bolt Trig - Buried Block Trig - Centre Trig - FBM Trig - Pillar Trig - Rivet Trig - Surface Block Trig - User Added Hill Traditional ", 0 VarName=$form #******************************************************************** # Form generated by GSAK form designer on Thu 15-Oct-2009 17:36:23 #******************************************************************** Name = Form1 Type = Form Height = 357 Width = 228 Name = dialMM Type = Checkbox Exitonchange = Yes Height = 25 Left = 16 Top = 56 Width = 17 Taborder = 8 Name = Label1 Type = Label Height = 20 Left = 32 Size = 12 Top = 58 Width = 91 Caption = Memory Map Name = dialPDA Type = Checkbox Exitonchange = Yes Height = 23 Left = 16 Top = 202 Width = 17 Taborder = 9 Name = Label2 Type = Label Height = 20 Left = 32 Size = 12 Top = 204 Width = 33 Caption = PDA Name = OK Type = Button Height = 25 Left = 16 Top = 288 Width = 75 Taborder = 10 Name = Label3 Type = Label Height = 16 Left = 16 Size = 10 Style = bold Top = 32 Width = 61 Caption = Export to Name = diallabels Type = Checkbox Exitonchange = Yes Height = 17 Left = 34 Top = 84 Width = 15 Taborder = 11 Name = Label4 Type = Label Height = 13 Left = 52 Top = 86 Width = 54 Caption = Label icons Name = storage Type = Edit Height = 21 Left = 32 Top = 240 Width = 169 Taborder = 12 Name = Label5 Type = Label Height = 13 Left = 32 Top = 224 Width = 152 Caption = Name of storage card on device Name = Label6 Type = Label Height = 13 Left = 34 Top = 266 Width = 167 Caption = (leave blank to copy to device root) Name = Label7 Type = Label Height = 12 Left = 96 Size = 7 Top = 14 Width = 47 Caption = Version 3.2 Name = Label8 Type = Label Height = 20 Left = 16 Size = 12 Style = bold Top = 10 Width = 74 Caption = PUP-Port Name = dialnet Type = Radiobutton Height = 17 Left = 32 Top = 168 Width = 65 Taborder = 13 Caption = Internet Name = dialdevice Type = Radiobutton Height = 17 Left = 96 Top = 168 Width = 65 Taborder = 14 Caption = Device Name = labname Type = Edit Height = 21 Left = 32 Top = 120 Width = 169 Taborder = 15 Name = Label9 Type = Label Height = 13 Left = 34 Top = 106 Width = 74 Caption = Labelling format Name = Label10 Type = Label Height = 13 Left = 36 Top = 148 Width = 32 Caption = Link to