GSAK (Geocaching Swiss Army Knife)
Contents - Index

Code binary file (Macro=>Code binary file)

This option is for use in combination with the macro function MimeDecode. It allows you to "embed" and then extract any binary file inside the macro language. It may not immediately be obvious why you would want to do this, but it adds a whole new dimension to the macro language.

Some of the more advanced macro users are wanting to distribute binary files (icons, bitmaps, etc - for example the GoogleEarth macro) in the macro. How best to do this? A zip file perhaps, but an installer would be better. However, not all macro writers would have access to an installer (and catering for all end users could be a challenge) so wouldn't it be great if we could "embed" binary files in a macro. This would allow macros to do a full install from start to finish placing any required binary files on the target computer - all using a single distributable macro.

Using the Macro option "Code a binary file" will allow you to select any file or group of files from a standard Windows dialog. When you click on OK, GSAK will generate the required macro code to store those files to the clipboard, then all you need to do is paste that code into your macro.

A simple example should illustrate this. We will embed a png graphic in the following macro, and if you run it should put the file test.png to the root folder of your c: drive and display it (you may want to delete this file after testing). If all works correctly the picture displayed should be the "house" icon from the tool bar:

$image = MimeDecode($test)
$result = PutFile("c:\test.png",$image)
fileopen file=c:\test.png
<data> VarName=$test

Copyright 2004-2015 CWE Computer Services  
Privacy Policy Contact