home *** CD-ROM | disk | FTP | other *** search
- /*
- This is an XDME macro to get an address from a QuickFile addressbook
- and insert it into the current document
- Called from xdme with command "rx1 address lastname"
- This also works with DME but needs "rx1 address.xdme lastname"
- Should be easy to adapt to a word processor
- */
-
- options results
-
- parse arg name
-
- address "QUICKFILE.01"
-
- /*
- Try to find the QuickFile addressbook
- */
-
- "setfile"
- if rc > 0 then
- call ErrorProc "Error from setfile command"
-
- if upper(result) ~= "ADDRESSBOOK" then
- do
- "setfile addressbook"
- if rc > 0 then do
- "openfile 'QuickFile:QuickFile3/Examples/AddressBook/AddressBook'"
- if rc > 0 then
- call ErrorProc "Cannot find addressbook file"
- end
- end
-
- /*
- Find the right record
- */
-
- "goto" name /* find the record - exact match not required */
-
- /*
- Get the field values
- */
-
- "GETFIELD Lastname"
- lastname = result
- "getfield FirstName"
- firstname = result
- "getfield Street"
- street = result
- "getfield Place"
- place = result
- "getfield state"
- state = result
- "GETFIELD Country"
- country = result
- "getfield Postcode"
- postcode = result
-
- /*
- Pass them back to XDME. The results should like
-
- Alan Wigginton
- 23 Carissa Street
- Shailer Park QLD 4128
- Australia
-
- Dear Alan,
-
- */
-
-
- address /* send commands back to original host */
-
- "("firstname Lastname")" /* This inserts text into the document */
- "return" /* This goes to the next line */
- "("street")"
- "return"
- "("place state postcode")"
- "return"
- "("country")"
- "return"
- "return"
- "return"
- "(Dear" firstname",)"
- "return"
- "return"
-
- exit
-
- /*-------------------------------
- Return an error string
- -------------------------------*/
-
- ErrorProc:
-
- parse arg msg
-
- address
- "("msg")"
- exit
-