GPSTurbo Credits
Programmed by Kevin Pickell
Started: April 10, 2006, Current Build: Oct 6 2007

The Groundspeak Geocaching 4-box square logo is a registered Trademark of Groundspeak Inc. Used with Permission. All Rights Reserved.
Cache icon graphics (c) 2005 Groundspeak Inc. Used with permission.

Libraries/Code included in this program:

kGUI: Build:Oct 6 2007
GPSBabel: 1.3.4-beta20070711 / Expat: expat_2.0.0
FreeType: 2.1.10
JpegLib: 6b
PNGLib: 1.2.8
ZLIB: 1.2.3

Special thanks to:

The GPSBabel team.
John Mechalas for his Garmin IMG format documentation.
Google Maps
Center for Topographic Information Canada
National Geophysical Data Center USA. geomagc 2005
Ed Williams, Great Circle Calculator
Keld Helsgaun, LKH - traveling salesman heuristic.
Clive, author of GSAK.


 GPSTurbo
GPSTurbo is a program for Geocachers that allows them to manage and plan their Geocaching outings.
A quick overview of features include:
Loading of Geocache waypoints from a GPX file, or any other file format supported by GPSBabel.
Viewing Geocache Waypoints overlayed onto various maps
Uploading and Downloading of waypoints and tracks to your GSPr
Planning of Routes
Printing of Maps and Waypoint lists
Built in scripting language to automate repetitive tasks


 Main Menu
Menu EntryFunction
Load GPX fileA Loadfile requestor will appear for you to select the file to load. Once you have selected a file then the LoadSettings panel will appear. This panel allows you to either Load the Waypoints or Load the Found flags into a UserTick field. If you are loading the Waypoints then you can input a database name to assign the Waypoints to, you can also limit the number of Logs imported using the input boxes ( no value means unlimited ). If you are loading the Found status into a UserTick field then you select the field to load into and you can assign a hint that will appear when the mouse pointer is left hovering over the column header. If the file contained any Tracks then a list of track will be shown, just tick the ones you wish to load.
Save GPX fileA Savefile requestor will appear for you to select the location and filename to save as. If you have any tracks then a requestor will also appear and you can select any tracks that you want saved as well. The current filtered waypoint list will then be saved along with any selected tracks.
Load As ...A Loadfile requestor will appear for you to select the file to load. Then a requestor will appear for you to select the file format. The list includes all of the file types that GPSBabel understands. Once you have selected a file and format then the LoadSettings panel will appear. This panel allows you to either Load the Waypoints or Load the Found flags into a UserTick field. If you are loading the Waypoints then you can input a database name to assign the Waypoints to, you can also limit the number of Logs imported using the input boxes ( no value means unlimited ). If you are loading the Found status into a UserTick field then you select the field to load into and you can assign a hint that will appear when the mouse pointer is left hovering over the column header.If the file contained any Tracks then a list of track will be shown, just tick the ones you wish to load.
Save As ...A Savefile requestor will appear for you to select the location and filename to save as. Then a requestor will appear for you to select the file format. The list includes all of the file types that GPSBabel understands. If you have any tracks then a requestor will also appear and you can select any tracks that you want saved as well. The current filtered waypoint list will then be saved along with any selected tracks.
Rename DatabaseUse this function to rename waypoints from one database name to another.
Remove Stale WaypointsThis function will display a table showing the number of waypoints with each unique generated date. Beside each entry in this table is a tickbox to select all waypoints with that date. Just tick the lines that you wish to delete and it will remove all waypoints with the selected dates.
Print TableThis function is used to print the current filtered waypoint results as a table. Currently it only prints one page wide, this may be fixed in the future.
Print MapThis function is used to print a Map centered on the current position shown. The print preview requestor will appear and will allow panning of the area to print. The print function can print from 1 to 10 pages wide and 1 to 10 pages tall. There are a bunch of other printing options on the print preview panel.You can also print waypoint information along the right edge of the map. When selected you can adjust the width of the edge and you can customize what information you would like to appear along the edge. This can be very handy for showing waypoint hints. If there are more lines than can fit on the page then the extra lines will not appear.
Save BitmapThis function is used to data-mine an area of the map and save it as a Jpg Image. Here are the steps required.
1) Right click on the map at the desired position and select Set Upper Left Corner for Map Select.
2) Right click on the map at the desired position and select Set Lower Right Corner for Map Select.
3) If desired you can zoom in or out to the desired level.
4) Now from the main menu select Save Bitmap.
5) A Savefile requestor will appear for you to select the location and filename to save as.
6) Wait... This can take a while if you are saving a large image.
7) To clear the selected range from the map Right Click on the map and select Clear Map Select area
View Filtered Cache Pages in BrowserThis will show the Geocache waypoint descriptions for all of the Waypoints in the Filtered Results List in your browser. You can then print them from your browser, most browsers will allow you to print them at 1/2 or 1/4 size to save paper.
View Filtered Cache Pages in WindowThis is the same as the previous line except that they are shown in a window within GPSTurbo. Note: The GPSTurbo HTML renderer is currently not finished so it may not appear correctly at this time.
CreditsA Popup window will appear showing the Build version and other information.
View Help Page in BrowserThis will open this help page in your current browser.
View Help Page in BrowserThis is the same as the previous line except that they are shown in a window within GPSTurbo. Note: The GPSTurbo HTML renderer is currently not finished so it may not appear correctly at this time.
QuitExit the program and save all changes and settings.


 Filtered/Map
Current Map
This pulldown is used to select the desired map.

Zoom
This pull down can be used to quickly change the zoom level..

Zoom In / Zoom Out
These buttons are used to zoom in and out of the current map. You can also use the keyboard CTRL + or Ctrl - to zoom in and out.

Online
This tickbox is used to tell GPSTurbo if you are currently online.
When online, GPSTurbo will try and download map tiles for online maps if they are not already in the map tile cache.

Map Position under Mouse
This will show the current Lat / Lon position on the map under the mouse pointer.

Current Filter / Current Database / Reverse / Search String
These settings are used to select the filtered waypoints from the full waypoint list, which are then shown in the table below.
To select using a filter, use the pull down menu to select the desired filter. To show all waypoints select the first entry in the filter pulldown (Show All) and make sure the Search String inputbox is empty. To only search in a particular database just use the Current Database pulldown to select the desired database. To show the Reverse results of any search just select the Reverse tickbox.To search the filtered results for a text string, just type the string to look for in the Search String box and press return.

Filtered Results
This shows the number of waypoints that match the current filter and the total number of waypoints in the full waypoint list.

Current Center Position
You can set a current center position by Right Clicking on the Map and select this entry from the popup menu. This box will then show that current center position. The Dist column in the table below will show the distance between the current center position and the position for each waypoint entry in the table.

Near Distance
You can set a near distance ( it is in the current map units that you can see in the bottom right corner of the map and if desired you can change it on the draw settings page ). The Near column in the table below will then show the number of waypoints ( in the filtered results ) that are within that distance of each waypoint. If desired you can then sort the filtered results table by the Near column and this can be helpful for finding areas with a large concentation of waypoints that are close to each other.

GPS18 - Connect / Track / Position
This is still under development, when selected GPSTurbo will connect to a Garmin GPS18 and track your current position. Selecting the first tickbox (Connect) will initialize communication with the GPS18 and when connected will show the current position in the Position boxes. Selecting the second tickbox (Track) will make the map follow the GPS18's current position.

Filtered Waypoint Results Table
This table shows the current filtered results from the full waypoint list.
Double clicking on a label on the map will move the cursor on the filtered results table to that waypoint. Right click on the waypoint name for a options menu. Double click on the waypoint name to center the map at that position.
You can adjust the column widths by clicking on the column headers and dragging left or right. You can change column width, hide and show columns and reorder them by right clicking on the top left table box and using the popup menu to make the desired changes.
Right clicking on the column header will open a popup menu with the following options:
Menu EntryFunction
Sort Ascending
Sort Descending
This will reset the sorting and sort based on the column selected.
Hide ColumnSelect this entry to hide the column.
Secondary Sort Ascending
Secondary Sort Descending
This will append the sort to the previously set sort columns. For example, if you want to sort the filtered results by Difficulty, then Terrain, then Type, then Name. Right Click on Difficulty, then select Sort Ascending, then Right Click on Terrain and select Secondary Sort Ascending, then Right Click on Name and select Secondary Sort Ascending.
UserTick Columns Only:
Clear All
Set All
Set Column Hint
A common use for the UserTick flags is to load the Found flags for other cachers who you regularly do group caching with.
Use these commands to Clear all ticks, set all ticks or set the hint for the selected column.
The column hint will appear when the mouse is hovered over the particular column header and would typically be set to the Cacher's Name whose Founds have been assigned to that column.


Drag Bar
Click and move the Drag Bar up and down to adjust the relative sizes of the Table and Map.

Map
This is the area where the current map is displayed.
Right Clicking on the map will bring up a popup menu.
If there are multiple waypoint labels under the mouse pointer position, then a menu will appear showing all Waypoint names near the mouse pointer for you to select the desired one.
Menu EntryFunction
Set as CenterSelecting this will set the Current Center Position to the position on the map. If you clicked on a Waypoint label then the position is set to the Waypoint's position.
SelectThis will select the Waypoint named at the top of the popup menu.
View Webpage in browserThis will show the offline webpage the Waypoint named at the top of the popup menu in a Browser.
View Webpage in windowThis is the same as the previous line except that they are shown in a window within GPSTurbo. Note: The GPSTurbo HTML renderer is currently not finished so it may not appear correctly at this time.
Add to RouteThis will add the Waypoint named at the top of the popup menu to the current route.
Toggle FoundThis will toggle the Found field for the Waypoint named at the top of the popup menu.
Toggle User1 TickedThis will toggle the UserTick1 field for the Waypoint named at the top of the popup menu.
Toggle Not AvailableThis will toggle the Not Available field for the Waypoint named at the top of the popup menu.
Clear Map Select areaThis will clear the current Map Select Area and stop drawing the select area rectangle on the map.
Set Upper Left Corner for Map SelectThis will select the upper left corner for the map selection area.
Set Lower Right Corner for Map SelectThis will select the lower right corner for the map selection area.
Add Point to Full Waypoint ListThis will a new Waypoint to the Waypoint table. It will be defined as a User Type of Waypoint.
Select Nearest Track SectionUsing the current track, this will move the cursor for the track table to the entry nearest the mouse pointer.
Add Point to the Current TrackThis will append the point at the mouse position to the end of the current track.
Add [Way]Point to the Current LinesThis will append the point ( or Waypoint ) at the mouse position to the end of the current lines group.


 Routes
Up / Dn
These buttons are for re-ordering the waypoints in the current route. Just click on the desired row to move, then press the Up or Down buttons to move it up or down in the list.

Auto Order
This button will re-order the route using a Traveling Salesman heuristic to calculate the shortest route that connects all points in the route. It starts at the first point in the list so you need to manually move the starting point to the top of the list if it is not already there. For long routes this function can take a minute or more. Currently the distances between waypoints are a straight line with no consequence for crossing water etc. In a future version this will use road routing to calculate the distances between waypoints.

Current Route
This pulldown is used to select the route to be viewed or edited. To make a new route just select the first entry (New Route) and then add Waypoints to it. If the current route has changes made to it then you will not be able to change this pull down to another route until you either saved the changes in the current route or cancelled ( using undo ) the changes.

Save Route
After adding Waypoints to a New Route click this button to assign a name to your newly created route. . Or press to save changes to an existing route.

Undo Changes
This will remove all changes to the current route since it was last saved.

Delete Route
This will delete the current route from the list of routes.

Rename Route
This will allow you to change the current route's name.

Copy Route
This will allow you to make a copy of the current route.



 Tracks
Up / Dn
These buttons are for re-ordering the waypoints in the current track. Just click on the desired row to move, then press the Up or Down buttons to move it up or down in the list.

Current Track
This pulldown is used to select the track to be viewed or edited. To make a new track just select the first entry (New Track) and then add Waypoints to it. If the current track has changes made to it then you will not be able to change this pull down to another track until you either saved the changes in the current track or cancelled ( using undo ) the changes.

Save Track
After adding Waypoints to a New Track click this button to assign a name to your newly created track. Or press to save changes to an existing track.

Undo Changes
This will remove all changes to the current track since it was last saved.

Delete Track
This will delete the current track from the list of tracks.

Rename Track
This will allow you to change the current track's name.

Copy Track
This will allow you to make a copy of the current track.

Simplify Track
This will allow you to reduce the number of points in the track. A input box will appear, just type in the number of points you want the track reduced to and it will reduce it down to that many points as best it can.

Draw Track
This tickbox, when selected will show the track on the main map screen.

Track Color
This is the color that the track will be drawn with on the main map screen.

Double Clicking
Double clicking on either the Lat or Lon field in the track points table will center the map on that position and switch to the main map screen.

Creating Areas
You can also use the tracks to create Areas for use in filters.
For example: If you have two islands very close by and want to have a filter that only shows wayponts on one of the islands then you can do the following. Right click on the map and select add point to track 'New Track' and do this over and over, creating a perimiter around one of the islands ( it will assume that the last point connects back to the first). When done, save the track and call it 'island1'. Then in your desired filter, add Position is inside island1 to the list of filter commands and the filter will now only return results inside the desired area.


 Lines
Lines are lists of primitves that you can use to draw lines, arcs and circles as overlays on the current map. The lines draw processor starts at the top of the list of primitives and works it's way down the list. Draw primitives like Line, Circle and Arc use previously defined values for their drawing, so things like distance and radius must be defined before them in the list.

Up / Dn
These buttons are for re-ordering the entries in the current lines table. Just click on the desired row to move, then press the Up or Down buttons to move it up or down in the list.

Current Lines
This pulldown is used to select the lines group to be viewed or edited. To make a new lines group just select the first entry (New Lines) and then add Waypoints to it. If the current lines group has changes made to it then you will not be able to change this pull down to another lines group until you either saved the changes in the current lines group or cancelled ( using undo ) the changes.

Save Lines
After adding entries to the lines table New Lines click this button to assign a name to your newly created lines group. Or press to save changes to an existing lines group.

Undo Changes
This will remove all changes to the current lines group since it was last saved.

Delete Lines
This will delete the current lines group from the list of lines.

Rename Lines
This will allow you to change the current lines group's name.

Copy Lines
This will allow you to make a copy of the current lines group.

Draw Lines
This tickbox, when selected will show the lines group on the main map screen.

Line Table Primitives
This table shows the entries in the current lines group. To add new entries just click on the * on the bottom row and then change the row values as desired. To delete a row just click on the selector on the left of the row and press the delete key.
After adding an entry to the table, just change the type by using the combobox in the first column.

Primitive TypeValue1Value2Description
WaypointWaypoint NameUnusedDefines a point.
PointLatitudeLongitudeDefines a point.
HeadingTypeValueDefines a heading angle.
DistanceTypeValueDefines a distance.
RadiusTypeValueDefines a radius.
ProjectUnusedUnusedProjects a new point from the last defined point using the last defined heading and distance.
ColorColor ValueUnusedSets a new color for drawing.
ThicknessThickness PixelsUnusedSets a new thickness for drawing.
LineUnusedUnusedDraws a line between the last two points using the current color and thickness.
ArcClockwise / CounterclockwiseUnusedDraws an arc using the current color and thickness, starting at the last defined point, using the last defined radius, starting tangent to the last defined heading and going the last defined distance. Arc goes clockwise or counterclockwise depending on the selected type. Use a negative distance for having the arc starting 180 degress from the last heading. Set's the current point to the ending position of the arc, and the current heading to the ending heading.
CircleUnusedUnusedDraws an circle using the current color and thickness, centered at the last point, using the last defined radius


 Filters
Current Filter
This pulldown is used to select the filter to be viewed or edited. To make a new Filter just select the first entry (New Filter) and then add rows to it by clicking on the bottom row in the table. If the current filter has changes made to it then you will not be able to change this pull down to another filter until you either saved the changes in the current filter or cancelled ( using undo ) the changes.

Save Filter
After adding rows to a New Filter click this button to assign a name to your newly created Filter. Or press to save changes to an existing filter.

Undo Changes
This will remove all changes to the current Filter since it was last saved.

Delete Filter
This will delete the current Filter from the list of Filters.

Rename Filter
This will allow you to change the current Filter's name.

Copy Filter
This will allow you to make a copy of the current Filter.

Filter Entries Table
This table shows the entries in the current filter. To add new entries just click on the * on the bottom row and then change the row values as desired. To delete a row just click on the selector on the left of the row and press the delete key. Each row in the filter is logically and'ed so all entries need to be True for a Waypoint to be in the filtered results.


 Draw Settings
Up / Dn
These buttons are for re-ordering the label colors in the table below. Just click on the desired row to move, then press the Up or Down buttons to move it up or down in the list.

Label Color Table
This table is used to assign different colors to the Waypoint Labels drawn on the Map. To add new entries just click on the * on the bottom row and then change the row values as desired. To delete a row just click on the selector on the left of the row and press the delete key. The first column will list the filter to use and the next column will contain the color to draw the label on the map. When assigning colors to the labels the program starts at the top of this list and uses the color for the first entry that matches the selected filter. The third column is just for informational purposes and shows the number of labels that match that filter at that point in the list.

Map Paths
This table is used to list the paths to maps to use. You can add multiple paths to the table. If you have any Garmin IMG maps installed then typically they are installed in the C:\Garmin\ directory so adding this path to the table would allow you to use these maps. You can manually edit the path fields in each table entry, or click on the ... Button and use a file requestor to select the map directory.

Font Size for Waypoint Labels on Map
This is the point size to use for drawing Labels on the map.

Number of User Ticks to show beside Label on Map
This is how many user tick boxes are drawn to the left of the Label. (The leftmost tickbox would be UserTick1, then UserTick2 etc.)

Waypoint Name to use on Map
This is where you define the Label format for what will appear on the Map for each Waypoint. This string can contain static text intermixed with text from the various columns from the waypoint table. To insert text from a particular column just place a period '.' followed immediately by the column name. Use the abbreviated spelling that is used on the comumn headers of the Filtered Results table.

Show Labels for Additional Waypoints on Map
When ticked, Child Waypoints ( typically Parking or Trailhead Coordinates ) are also drawn on the map.

Move overlapping Labels
When ticked, any Labels that overlap another Label are moved down to the next available space and a line is drawn to show where the Label should have been.

Move overlapping Labels, Maximum number of pixels
When Labels are moved, this is the maximum distance (in pixels) to move them before giving up and drawing them at their original (overlapping) position.

Zoom level to start drawing Labels at
The Map Zoom level starts at 1 for the highest zoomed out level and increases as the map is zoomed in. If the zoom level is less than the number in this inputbox then Labels are not drawn on the Map.

Distance Units
This is used to select which type of distance units are shown in the Filtered Waypoint Results table for the Dist (distance from centerpoint) column, it is also the units drawn on the bottom right of the Map.



 GPSRs
GPSr Table
Use the table to define the various GPSr settings for the GPSrs that you have.

Current GPSr
Use this pulldown to select the GPSr to use when Uploading or Downloading.

Upload Waypoints to GPSr
Press to upload the filtered waypoints to the current GPSr. If the current filtered results contain more waypoints than the current GPSr can handle it will only upload the maximum number of waypoints starting at the top of the table. For example if your GPSr can only handle 500 waypoints and your filtered results have 2600 waypoints then only the first 500 in the table will be uploaded. To force a particular area of waypoints to be uploaded you can use the Set Center Point function ( from the main map screen ) to set a center point to the area you wish to upload and then sort the waypoint results based on the distance from that centerpoint. That way the waypoints nearest your centerpoint will be at the top of the filtered results table and will be uploaded first. Many GPSrs do not have any error reporting back to the computer if their waypoint tables are full. After uploading it will download the points from the GPSr to verify that the points were uploaded corectly. If any points were not found then it will list them in a popup window and you will need to manually delete old waypoints from your GPSr to free up space.

Download Waypoints from GPSr
Press to download waypoints from the current GPSr. Matching waypoints found in the full waypoints list will be skipped as they already exist, new waypoints will be added to the waypoints table as USER waypoints and named USER_XXX where XXX is a unique number.

Upload Tracks to GPSr
Press to upload Tracks to the current GPSr. A popup menu will appear showing all of the tracks, just tick the ones you want to upload. After uploading it will automatically download them from the GPSr to verify if they were uploaded correctly. Some GPSrs have a limit on the number of points allowed in a track so you might get an error message like Track 'xxx' only the first 500 of the 2600 points were uploaded. In this case you need to reduce the number of points in that track to the number that it reported. On the track page just use the Simplify Track button to reduce the number of points in that track.

Download Tracks from GPSr
Press to download Tracks from the current GPSr. A popup window will appear showing the tracks on the GPSr, just select the tickbox beside each track you wish to download.


 Solver
 Decode
Plain Text
Put your plain text in here to encode or if decoding then the results will be placed here.

Encoding
Use this pulldown to select the encoding format.

Key
Some encoding formats use a key, so if the one you are using does then you can type the key here.

Encode (Plain -> Encoded)
After typing ( or pasteing ) in some text in the plain box above and selecting an encoding method ( and key if applicable ) then pressing this button will generate the encoded text in the encoded text box below.

Decode (Encoded -> Plain)
After typing ( or pasteing ) in some text in the encoded box below and selecting an encoding method ( and key if applicable ) then pressing this button will generate the decoded text in the plain text box above.

Encoded Text
Put your encoded text in here to decode or if encoding then the results will be placed here.

 Project
From
Put the starting position ( Lat / Lon ) in these two boxes.

Distance
Put the distance in this box and select the units in the pulldown.

Heading
Put the heading in this box and select the heading type in the pulldown.

Earth Model
Although all coords are in WGS84, you can specify a different Earth Model if desired.

Calculate
Press to generate the projected point results.

To
The projected point ( Lat / Lon ) is shown in these two boxes.

 Distance
Point A
Put one position ( Lat / Lon ) in these two boxes.

Point B
Put another position ( Lat / Lon ) in these two boxes.

Distance Units
Select the desired distance units in the pulldown.

Heading type
Select the desired heading type in the pulldown.

Earth Model
Although all coords are in WGS84, you can specify a different Earth Model if desired.

Calculate
Press to generate the distance and heading between the points.

Distance
The distance between the the points is shown here.

Heading A to B
The heading from point A to B is shown here.

Heading B to A
The heading from point B to A is shown here.

 Sunrise / Sunset
Location
Put the position ( Lat / Lon ) in these two boxes.

Day
Put the day of the month (1-31) here.

Month
Select the Month using the pulldown.

Year
Put the desired year here.

TimeZone
Select the timezone for the results here using the pulldown.

Zenith
Select the desired Zenith, if you don't know what this is then leave it on Official.

Calculate
Press to generate the sunrise and sunnset times.

Sunrise
The sunrise time results will be generated here.

Sunset
The sunset time results will be generated here.



 Stickers
Stickers are sometimes used to place on geocache logbooks instead of signing them.
Currently it only supports 1 label size and that is the Avery labels that are 80 stickers on a sheet ( 20 rows of 4 ), the stickers themselves are 1.75" x .5"
You can use the primitives in the sticker table below to define your sticker art, or you can have your sticker made in advance (using your own art program like Photoshop), the size should be 350 pixels wide by 100 pixels tall and then just add one entry to the table to load the image file.

Current Sticker
This pulldown is used to select the Sticker to be viewed or edited. To make a new Sticker just select the first entry (New Sticker) and then add rows to it by clicking on the bottom row in the table. If the current Sticker has changes made to it then you will not be able to change this pull down to another Sticker until you either saved the changes in the current Sticker or cancelled ( using undo ) the changes.

Save Sticker
After adding rows to a New Sticker click this button to assign a name to your newly created Sticker. Or press to save changes to an existing sticker.

Undo Changes
This will remove all changes to the current Sticker since it was last saved.

Delete Sticker
This will delete the current Sticker from the list of Stickers.

Rename Sticker
This will allow you to change the current Sticker's name.

Copy Sticker
This will allow you to make a copy of the current Sticker.

Print Sticker
This will open a print preview screen showing the full page of stickers. You can then print it by clicking the print button.

Sticker Entries Table
This table shows the entries in the current Sticker. To add new entries just click on the * on the bottom row and then change the row values as desired. To delete a row just click on the selector on the left of the row and press the delete key. Each table entry is for a draw primitive object to be drawn on the label. For each table entry use the pull down menu in the first column to select the primitive type.
For a text entry, select the color using the pull down, then the x & y pixel positions (w & h are not used) then the font size to use and finally the text to draw.
For a image entry, set the x & y pixel positions (w & h are not used) then the size is a scale factor to resize the image then and finally the text box should contain the filename for the image. If you double click on the filename box you can use a file requestor to select the image.
For a rectangle entry, select the color and then the x & y pixel positions and w & h pixels sizes for the rectangle.


 Basic
For scripting repetitive tasks you can write your own code using a variant of Basic called kBasic. The syntax and built-in commands are described further down in the instructions.

Start
Press this button to run a Basic Subroutine. When pressed, a popup menu will appear showing all Public Subroutines that don't take any parameters.

Abort
When a Basic program is running you may press Abort to stop execution.

Source Code InputBox
This input box is where you can write your own Basic Subroutines and Functions.


 kBasic
kBasic is a variant of Basic that is similar to Visual Basic and has some expression functions borrowed from C++.
All commands and variable names are not case sensative.
All variables must be defined before being used.
All variables default to uninitialized and are not explicitly set to zero or null.


 Data Types
TypeDescriptionExample
BooleanTrue or FalseDim VarName as Boolean
Integer32 Bit Signed Integer ValueDim VarName as Integer
DoubleFloating Point ValueDim VarName as Double
StringStringDim VarName as String
VariantCan automatically change between Boolean, Integer, Double and StringDim VarName as Variant
DateDate and Time ClassDim VarName as Date
Enum XXX [as Type]
VarName [=Value]
End Enum
User Enumerated Constants. These are only to be defined in the global scope outside of a Subroutine or Function.
If Values are not supplied then increasing values starting with zero are used.
Enum Cars as Integer
Porsche
Ferrari
Lamborghini
End Enum
print Porsche, Ferrari, Lamborghini
0 1 2
Type XXX
End Type
Define User Types (Structure)Type LogData
id as Integer
LogDate as String
Name as String
End Type
ArraysAll types can be in multi dimensional arraysDim VarName[10] as String
Dim VarName[10][256] as Integer
Dim VarName[] as Double


 Subroutines and Functions
Subroutines and Functions are the the same except for the fact that functions return a value.
Both Subroutines and Functions can take multiple parameters. Each parameter can have it's own type and can be passed by value or by reference.
User Types (Structures) and Arrays as always passed by Reference.
Functions can return the result value in two different ways. One way is to reference the function name as a variable and assign it the return value, you can also use the return command with the return value as a parameter.

Syntax:
[Public] Sub[([{ByVal|ByRef}] varname As type [,...])]
[Public] Function[([{ByVal|ByRef}] varname As type [,...])] As returntype

A Few Examples:

Public Sub PrintSum(count as Integer)
Dim i as Integer
Dim thesum as Integer
thesum=0
For i=1 to count
thesum+=i
Next i
Print "The Sum from 1 to " & count & " is " & thesum
End Sub

Public Function ReturnSum(count as Integer) as Integer
Dim i as Integer
ReturnSum=0
For i=1 to count
ReturnSum+=i
Next i
End Function

Public Sub AppendSpaces(ByRef s as String,ByVal count as Integer)
Dim i as Integer
For i=1 to count
s+=" "
Next i
End Sub



 Commands
CommandDescriptionExample
If
ElseIf or Else If
Else
Endif or End If
Single line If:
If expr statments
Multi line If:
If expr Then
statments
[ElseIf expr Then]
statments
[Else]
statments
Endif
If a==5 b=21
If a==5 goto finished

If a==5 then
Print "Hello"
Elseif a==6 Then
Print "World"
ElseIf a==7 then
Print "Today"
Else
Print "Unknown"
Endif
Do
Loop
The Do/Loop commands can have expressions at both the Do and Loop lines. Use the Exit Loop Command to skip to the next statment following the Loop.
Do [{While|Until} expr]
statments
Loop [{While|Until} expr]
Do While a<99
Print a
++a
Loop

Do
Print a
++a
Loop Until=100
While
Wend
While expr
statments
wend
While a<100
Print ++a
Wend
For
Next
The Loop variable needs to be an Integer or Double.
If no Step is defined then the variable increments by 1 per loop.

For var = startexpr to endexpr [Step incrementexpr]
statments
Next [var]
For a = 1 to 100
Print a
Next

For b=1.0 to 5.5 Step 0.5
Print b
Next b
Select
Case
The testexpression needs to be one of the basic types: Integer, Double or String
Select testexpression
Case expressionlist
statments
[Case expressionlist]
[statments]
[Case Else]
[statments]
End Select
The expressionlist can be one of three types.
expr1 To expr2 Range of values
Is {=,<=,>=,!=,<^gt;}expression Comparision using comparator
expr Equals value
Select inputvar
Case "y","Y"
Print "Yes"
Case "n","N"
Print "No"
Case Else
Print "Unknown"
End Select
GotoLabels in subroutines and functions are defined by having a labelname followed by a Colon at the beginning of a line.
You can only use the Goto command to go to a label that is within the current Subroutine or Function.

Goto label

goto skipall
Print "Hello World"
skipall: Print "Hello Again"
Call or GoSubThe Call or Gosub Command is optional and will automatically be done if a Subroutine or Function name in encountered.
If the Function or Subroutine doesn't take any parameters then the brackets are optional.

Call funcname [(parameters)]
Call MySort(arrayname,numentries,direction)
MySort(arrayname,numentries,direction)
Call DoThings()
DoThings()
DoThings
ReturnThe return command exits the current Subroutine or Function. When returning from a Function a return value can be supplied after the return command.
Return [expr]
Public Function MyFunc(InValue as Integer) as Double
If (InValue==0) Then
MyFunc=999.0
Return
EndIf
Return(3.14)
End Function
PrintPrint expressions to the console or if specified, a file.
Expressions seperated by a comma have a tab character inserted between the output, expressions seperated by semi-colons have no space between their output. If the last expression is not followed by a semi-colon then a carraige return is output last.
Print [#handle [,]] expr [{,;}expr....][;]
Print #1
Print #1,chr(13);
Print "Hello World"
Print a,b,c;
Print cos(PI)
InputIf the Line prefix is used then input only reads one string variable and assigns input until the next end of line or end of file.
If the Line prefix is not present then variables are input using comma delimiters or end of line or end of file.
Note: There is also an Input Function, see it's syntax in the Function table below.

[Line] Input #handle,var1[,var2...]
Line Input #1, a
Input #1,astring,anumber2,anumber3
InputBoxIf the user presses the cancel button then a trappable user abort error is generated. See the On Error commands for more information on trapping user errors.
InputBox prompt,variable
Input "Input A Number",num
InputBox prompt$,username$
OpenIf the file cannot be opened then a trappable file error is generated. See the On Error commands for more information on trapping file errors.
Open filename For {INPUT | OUTPUT | READ | WRITE | BINARY | ACCESS | APPEND} as #handle
Open "output.txt" FOR INPUT as #1
Open "input.txt" For OUTPUT as #1
Open name$ For BINARY READ as #2
Open fn$ for BINARY WRITE APPEND as #2
CloseClose #handleClose #1
Close #curhandle
Set or LetThe Set or Let Command is optional and will automatically be done if a variable followed by an assignment operator is encountered, of a variable with a modifier (++ or --).
Set variable {=,+=,-=} expr
Let variable {=,+=,-=} expr
variable {=,+=,-=} expr
Set a=5
Let a$="Hello"
a=99
circumference+=123
++counter
--countdown
DimArrays can be multi-dimensional and square brackets are used around each array entry size. If no expression is inside the square brackets then the array data is unallocated and would need to be allocated using the ReDim command below. Variables Dimed in the global scope are globals and can be referenced by all Functions and Subroutines. Variables Dimed inside a Function or Subroutine are local and only accessable within that object unless they are passed by reference to another Function or Subroutine.
Dim varname[arrayindices] as vartype
Dim name as String
Dim name$ as String
Dim table[100] as Integer
Dim counter as Integer
Dim coords[32][10][2] as Double
Dim days[] as Boolean
Dim LogInfo[] as LogRecord
ReDimThe ReDim command is for changing the array size or type ( or both ) of an existing variable. If the type is the same and the number of dimensions are the same then the Preserve modifier can be used to save and existing values.
ReDim [Preserve] varname[indices] as type
Dim list[][] As Integer
ReDim list[10][10] As Integer
Dim names[100] As String
ReDim Preserve names[200] As String
ExitThe Exit command is used to exit from a control loop or a Function or Subroutine
Exit {For|Do|While|Func|Sub}
For a=1 to 10
If a==5 Exit For
Next
OnThe On Error command is used to redirect execution when file or input errors occur. If there is no current setting then program execution stops.
On Error {Resume Next|Goto 0|Goto label}
On Error Goto fileopenerror
Open fn$ for Read as #1
On Error Goto 0
...
Exit Sub
fileopenerror:
MsgBox("Error Opening File '" & fn$ &"'",MSGBOX_OK)
WithThe With command is used as a shortcut to reference user types (Structures) without having to type the variable name over and over.
With [varname]
Type UserStruct
ID as Integer
Name as String
Money as Double
End Type

Dim CurrentUser as UserStruct
With CurrentUser
Print .ID,.Name,.Money
.Money+=10
End With
EndEnd {With|Select|Sub|Function}With Var
....
End With

Select Var
...
End Select

Public Sub MySub()
...
End Sub

Public Function MyFunc() as Integer
...
End Function


 Expression Operators
SyntaxDescription
expr ? expr1 : expr2if expr=true then result=expr1 else result=expr2
"||" or "or" logical or
"&&" or "and" logical and
"|" bitwise or
"^" or "xor"bitwise exclusive or
"&" bitwise and
"==" or "=" or "!=" "<>"test equals or test not equals
"<" or "<=" or ">" ">="test less then, less than or equal, greater than, greater than or equal
"<<" or ">>"bitwise shift left, bitwise shift right
"+", "-", "%" or "mod"add, subtract, mod
"^^" or "**"exponent
"not" or "!" or "~"not
"-" negative
"(", ")"parenthesis
"++var", "--var"pre increment variable, pre decrement variable
"var++", "var--"post increment variable, post decrement variable
"var+=expr", "var-=expr"add expression to variable, subtract expression from variable


 Functions
SyntaxExample
randReturn a random number
rand() as integer
lenReturn length of string
len(var as string) as integer
ascReturn the ascii value of the first character in the string
asc(var as string) as integer
valReturn the Integer value of the string
val(var as string) as integer
dvalReturn the Double value of the string
dval(var as string) as double
chr
chr$
Return a single character ascii string from the Integer supplied
chr(num as integer) as string
str
str$
Return a string representing the value supplied
chr(num as {integer|double|boolean}) as string
sinReturns the sine of the radian supplied.
sin(var as double) as double
cosReturns the cosine of the radian supplied.
cos(var as double) as double
tanReturns the tangent of the radian supplied.
tan(var as double) as double
asinReturns the radian value of the sine supplied.
asin(var as double) as double
acosReturns the radian value of the cosine supplied.
acos(var as double) as double
atanReturns the radian value of the tangent supplied.
atan(var as double) as double
eofReturn True if the end of file is encountered for the file handle
eof(var as integer) as boolean
trimReturns the string with leading and trailing white space removed
trim(var as string) as string
fileexistsReturns True if the filename exists
fileexists(filename as string) as boolean
left
left$
Returns the leftmost number of string characters
left(var as string,numchars as integer) as string
right
right$
Returns the rightmost number of string characters
right(var as string,numchars as integer) as string
mid
mid$
Returns the middle number of string characters starting at the start character and if the number of characters parameter is not present then it returns the rest of the string.
mid(var as string,startchar as string[,numchars as integer]) as string
instrIf string2 is found within string1 - InStr returns the position at which match is found. Cmpmode (0=case sensative,1=not case sensative).
instr(startpos as integer,string1 as string,string2 as string [,cmpmode as integer=0]) as integer
replaceReturns a string in which a specified substring has been replaced with another substring a specified number of times.
replace(before as string,subfrom as string,subto as string [,startchar=1 [,maxchanges=unlimited [,cmpmode=0]]]) as string
splitReturns a zero-based, one-dimensional array containing a specified number of substrings based on the split string. Use the ubound function to find out how many string were generated.
split(original as string,splitstring as string [,cmpmode=0]) as string array
iifReturns expression1 if testextpression is True, or expression2 if it is False
iif(testexpression as boolean,expression1 as variant,expression2 as variant) as variant
inputReturns a string read from an open file and only reads in the number of characters specified. If chr$(0) characters are encountered when reading then the resultant string will contain those characters within it.
input(numchars as integer,handle as integer) as string
msgboxThis function displays a message box on the screen and waits for the user to press one of the buttons to continue. The button pressed value is returned. If the window close icon ( upper right ) is pushed then the value MSGBOX_ABORT is returned. For the buttons to display parameter just add the constant values together for all the buttons you wish to have displayed, valid button values are: MSGBOX_YES, MSGBOX_NO, MSGBOX_OK, MSGBOX_CANCEL or MSGBOX_DONE
msgbox(prompt as string,buttons as integer) as integer
filereqThis function is used to display a filerequestor to allow the user to select a directory and or filename. The mode parameter should be one of two constants FILEREQ_OPEN or FILEREQ_SAVE. Next is the default path to use and finally the file extension to use if applicable, use the format ".xxx" or use an empty string "" if all extensions are valid. The function returns the full filename with path as a string. If the user presses the cancel button then a trappable error is generated. See the On Error commands for more information on trapping user errors.
filereq(mode as integer, path as string, extension as string) as string
shellexecThis function calls an external program, it returns immediately (TODO: add param to signal for waiting for completion! )
shellexec(program as string,parms as string,workingdir as string)
uboundReturns the highest available subscript for the indicated dimension of an array. If the dimension is not passed then the first dimension (0) is assumed.
ubound(arrayname as variant [,dimension as integer=0]) as integer
sortobjectsThis function is used to sort a single dimensional array of user Types (structures) or Classes. The sortstring is a string containing comma delimited field names to sort by, ascending order is assumed, for descending order put a '-' prefix before the field name.
sortobjects(arrayname as variant,numentries as integer,sortstring as string)
 Constants
Name
CACHETYPE_UNDEFINED
CACHETYPE_TRADITIONAL
CACHETYPE_MULTI
CACHETYPE_VIRTUAL
CACHETYPE_EVENT
CACHETYPE_UNKNOWN
CACHETYPE_REVERSE
CACHETYPE_EARTH
CACHETYPE_NGS
CACHETYPE_LETTERBOX
CACHETYPE_WEBCAM
CACHETYPE_CITO
CACHETYPE_PROJECTAPE
CACHETYPE_OTHER
CACHETYPE_NUM
CONTAINERTYPE_MICRO
CONTAINERTYPE_SMALL
CONTAINERTYPE_REGULAR
CONTAINERTYPE_LARGE
CONTAINERTYPE_OTHER
CONTAINERTYPE_VIRTUAL
CONTAINERTYPE_NOTCHOSEN
CONTAINERTYPE_NUM


 GPXRecordSet
NameDescription
N/ANot Available
FndFound
TypeCache Type
U1UserTick1
U2UserTick2
U3UserTick3
U4UserTick4
U5UserTick5
U6UserTick6
U7UserTick7
U8UserTick8
NameCache Name
WptNameWaypoint Name
LogStatLog Status
ContainerContainer Type
DiffDifficulty
TerrTerrain
DistDistance to Center
CorrCorrected
LatLatitude
LonLongitude
HintHint
User NotesUser Notes
OwnerOwner
StateState
CountryCountry
Gen DateGenerated Date
NearNear
U[]UserTicks - Can be accessed using this array reference as well.
NumLogsNumber of Logs.
LogID[]Log ID Array
LogDate[]Log Date Array
LogType[]Log Type Array
LogFinder[]Log Finder Array
LogText[]Log Text Array
LoadAllLoad All Records from Global RecordSet
LoadAll()
LoadFilterLoad Records from Global RecordSet using Filter
LoadFilter(filtername as string)
SeekRecordSeek Record #0-NumRecords-1
SeekRecord(recordnum as string)
NumRecordsReturn number of Records in Set
NumRecord() as integer
MergeRecordMerge Current Record into Global RecordSet
MergeRecord()
MergeRecordsMerge all Records into Global RecordSet
MergeRecords()
LoadFileLoad RecordSet from GPX File. If Append=true then records are appended to current records in set.
LoadFile(filename as string,databasename as string,Append as boolean)
SaveFileSave RecordSet to GPX File
SaveFile(filename as string)
UploadToGPSRUpload waypoints in RecordSet to the named GPSR.
UploadToGPSR(gpsrname as string)
DownloadFromGPSRDownload points from GPSR.
DownloadFromGPSR(gpsrname as string)