Technical Notes for
Garden® Utils
Introduction

This document lists some of the technical information about the app that you might find helpful. It is mainly for those who want to understand the HTML and Javascript used to create some of these documentation pages.

This is not a tutorial and assumes a reasonable amount of knowledge of HTML, Javascript, etc.

URLs

Most URLs are allowed in HTML content, subject to a few restrictions.

The scheme "file://" is restricted to the docs directory on your device.

The scheme "browser://" passes the URL-decoded text after the "//" to the iOS browser, switching from this app. For example:

browser://http%3A//www.gardenutils.com

opens Safari with the support site for this app.

The "gardenutils://" scheme contains a command line, with ";" separated commands, described below.

Commands

URLs starting with "gardenutils://" are processed by the app as commands. Each such URL can contain any number of commands, each separated by ";" characters. Whitespace is trimmed around the commands.

Commands consist of a command name and then one or more arguments, separated by single space characters. Some of the arguments are "varname" which means the name of a Javascript variable. It may be complex (such as foo.bar[1].value) as long as there are no spaces and it is appropriate for the situation.

You can use the commands in an "href=" or by setting the window.location object. Note, however, that only one such invocation is remembered at a time. URLs are usually interpreted as commands after your Javascript returns and the browser waits for input. This means that, for example, you can't use the result of "appvalues" in the same Javascript function as when the command is presented in a URL. To help you get around this restriction, you can use the "invokefunction" command to execute some of your Javascript at the time that the URL commands are executed.

The commands that have access to the pasteboard (pastetovar and varappendpaste) will use blank for the current pasteboard if the contents of the pasteboard were not set in this app since it last returned to the screen.

The commands are:

loaddecimal value - makes value (expressed in decimal) the current number on the Numbers screen

loadhex hexvalue - make value (expressed in hex) the current number

screen name - switches to screen "name" - currently may only be "numbers"

log a b c ... - concatentates args with " " and adds to logfile

lognl a b c ... - concatenates args with " " and adds to logfile followed by newline

logvar varname - appends value of Javascript variable varname to logfile

vartopaste varname - replaces pasteboard with value of Javascript variable varname

varappendpaste varname - appends value of Javascript variable varname to pasteboard

pastetovar varname - sets Javascript variable varname to text contents of pasteboard (this may have a size limit)

newfile filenamevar contentsvar format - creates file with name and contents from Javascript variables. The optional format arg may be the three characters "hex" for text files containing a simple hex dump (12 34 F1) such as produced by this app's simple hex dump. Use the Tools / Settings / Hex dump type / Simple to get a simple dump of files <128KB.

newfileshow filenamevar contentsvar format - creates file with name and contents from Javascript variables, then switches to viewing it. It takes the same optional format as the newfile command.

editlogfile - switches to logfile for editing

invokefunction functionname arg - executes Javascript: functionname("arg")

appvalues varname - saves some app values to Javascript object varname: version, currentnumber

alert titlevar bodyvar - displays an alert with the title and body from Javascript variables

debug on/off - controls logging of commands executed to logfile