LXChng Currency Conversion Program
Copyright (c) 2005 David Becher


Description
-----------
This program uses data from an exchange rate text file that can be 
obtained from the internet to update the values stored in the Currency 
Conversion section of the HP Calculator application.  

Overview
--------
In order to use LXChng, you will need a text file which has exchange 
rates for the currencies you are interested in.  A sample file is 
included for reference (smplrate.txt), but the rates in this sample file 
are not current.  One possible source for current exchange rates may be 
www.xe.com. Lxchng does not retrieve this file, you should use your internet
software (WWW/LX or LXTCP) to retrieve the file and save it to the
same location each time. In this documentation we will call this
the "rates file".

LXChng should be installed in the HPLX Application Manager.  The program 
is only designed to be run under System Manager.  (Note: A rough icon is 
included with the package)

The operation of LXChng is controlled by a configuration file named 
lxchng.cfg.  LXChng.cfg specifies the location of the application and 
rates file, the base currency to which the other currencies are
compared, and information on the format of the currencies for conversion in
the rates file.

The first time that you run LXChng, a template configuration file will 
be created in the directory where the executable file is located.  This 
template will contain the currencies that already exist in your HPCalc 
application.

After running LXChng for the first time, you will need to edit 
lxchng.cfg to match the data in your rates file.  After editing, running LXChng
 again will update the values stored in the Currency Conversion section of
HPCalc.  You may then update HPCalc with LXChng each time you obtain a new
rates file.

Legal Stuff and Acknowledgements
--------------------------------
Lxchng is freeware. You are allowed to do with it whatever you like with the
proviso that if you distribute it to a 3rd party that you do so only for
the complete package as provided. I take no responsibility for anything that
happens as a result of your using this software. However if, as a result of
your using LxChng, you become a multi millionaire overnight - remember where
you got it!

Many thanks to Ted Heise for testing LxChng and for writing most of this text
file.

Included files
--------------
Files included in the LxChng distribution package:
   lxchng.exe - the program
   lxchng.txt - this instruction file
   lxchng.icn - an icon to use for Application manager
   smplrate.txt - a sample currency exchange file

Upgrading from a previous version
---------------------------------
[NEW v0.6]	If you want to ignore stuff inside comments in an HTML version of
the rates file, add the line "SkipHtmlComments=1" to the "[default] section of
your cfg file.

New Installation
-----------------
1. Get a source file from the internet which has the exchange rate data 
   that you want to use for currency conversion. See the smplrate.txt 
   file for reference.  One possible source for current data may be 
   http://www.xe.com.

2. Copy the lxchng.exe file to your desired working directory.

3. Install LXChng in Application Manager. (Note: You may use the rough 
   icon included with the package, if you wish.)

4. Start the HP Calculator, open Conversions (Control-O), and select 
   Currency.

5. Add any currencies of interest to the list, using the F2 key to 
   select edit and then edit applicable names (or empty slots).  It 
   doesn't matter what you call them. (Some of mine are in Hebrew). It doesnt
   matter what exchange rates you enter

6. Run LXChng - it will create a template configuration file in the same 
   directory as the application, with entries for each currency int HPCalc

7. Edit lxchng.cfg using a text editor, so that it suits your rates file
   (see comments in lxchng.cfg for guidance). 

8. Run LXChng again (and again whenever you retrieve a new rates file)
    - the conversion data should be in HPCalc each time you open it. Note that
   whenever you run LxChng it automatically shuts down HpCalc.


Reference
---------
Here is an example of my configuration file (with added comments).

---------- begin example ---------------------------------------------
; Default config file for LXChng Currency Converter Program v0.1
; Copyright (c) 2001 David Becher

[default]
; Name of file containing exchange rate data.
; Edit to match your path and file name.
file=a:\mbox\curr.txt	
; It does NOT have to be a plain text file. It can also be for example a html
; file.

; offset (in bytes) from start of file to begin reading, 
; and optionally a text string from which to begin reading.
; LXChng will ignore anything before the offset and then will start searching
; for the text string. Once it has found the string, the currency search
: really begins
start=0,Currency Unit
;Uncomment the next line to ignore Html comments <!-- -->
;SkipHtmlComments=1

[defaultV]
; This section contains data relating to the currency values in 
; the exchange rate file.

; Format:
; CalcName=FileName,numbers,factor
;
; "CalcName" must match the name used in HP Calc.
; These are generated automatically the first time you run LXChng.
; If you add a currency later, this label must be all upper case.
;
; You must modify the data on the right of the "=".
; "FileName" is the matching text string in the rates file for which LxChng
; searches.
;
; "numbers" specifies which number after the text string to use (e.g.,
; first number, second number, and so on).
; NOTE:  This MUST be set to 0 for the currency you select as the base.
;
; "factor" is a multiplication factor, if needed (e.g., if the
; currency is in thousands).

DOLLAR=USD,0,1.000000 ; this is my base currency
SHEKEL=ILS,2,1.000000
AUSTRALIAN $=AUD,2,1.000000
THAI BAHT=THB,2,1.0
BRIT POUND=GBP,2,1.000000
DEUTSCHMARK=DEM,2,1.000000
EURO=EURO,2,1.000000

---------- end example ---------------------------------------------

Using a Batch File
------------------
I use a batch file to connect to the internet, which automatically runs
LxChng when I disconnect. Here is a copy:

---------- begin batch ---------------------------------------------
@echo off
rem this connects to the internet, does all my stuff, and sometimes saves
rem the rates file to a:\mbox\curr.txt
c:\bin\maxdos.com a:\lxtcp\lxtcp1.bat

rem currency conversion
if not exist a:\mbox\curr.txt goto END
a:\bin\lxchng.exe
if exist a:\mbox\curr1.txt del a:\mbox\curr1.txt
ren a:\mbox\curr.txt curr1.txt
:END
---------- end batch ---------------------------------------------

[NEW v0.6]Command line paramters & section names in the cfg file
----------------------------------------------------------------
If for some reason you want to define more than one set of conversion data
(for example you want to test a new source of conversion data without losing
your original), you can redefine the [default] and [defaultV] section
names using a command line argument. 

For example calling lxchng with the following command:

lxchng mybank

will cause LxChng to use the sections in the cfg file called
[mybank]

[mybankV]


Revision History
----------------
0.4 - First distributed version

0.5 - 29/11/05 Fixed comma separator bug

0.6 - 24/12/05 added explanation of command line paramter
    - added html comment support
	
How Lxchng  works
-----------------
The HPCalc program stores its status in a binary file which is stored on the
computer as C:\_dat\calc.env. LxChng shuts down HpCalc in ordeer to update this
file and then writes directly to the file. It took a while to hack the data
structures in Calc.env but they are not all that complicated. LxChng
automatically creates a backup copy of calc.env called calc.bak just in case
something goes wrong. If you have any problems succh as corruption of the
calculator operation, delete the calc.env file and HpCalc will create a new
one automatically. If problems reoccur, you can send me the calc.env file,
lxchng.cfg and your rates file and I will try to figure out what went wrong.

David Becher 25/11/05
davidb@netmedia.net.il
