DECLARE FUNCTION StripChar$ (constr$, char$, replacewith$)TYPE mailitabc dummy AS STRING * 28 fullname AS STRING * 81 email AS STRING * 81END TYPEDIM record AS mailitabcCLS : PRINT "Converting Mail Address .CSV file to various other formats."PRINTPRINT "Written by Stephen Knight 10.10.96 "PRINTimportfrom$ = COMMAND$IF importfrom$ = "" THEN PRINT "You have not specified a file to convert on the command line, eg:" PRINT PRINT "ADDRBOOK solihull to import solihull.csv in the current directory" PRINT LINE INPUT "Name of file to import : "; importfrom$ IF importfrom$ = "" OR INSTR(importfrom$, ".") > 0 THEN ENDEND IFPRINTPRINT "CONVERTING TO :"PRINT "nndbase.txt for Eudora Light"PRINT "nndbase.my for Eudora (rename to .txt)"PRINT "nndbase.pro for Eudora Pro V3.0 (rename to .txt)"PRINT "address.htm for Netscape 2.01 Address Book"PRINT "addrbook.htm for viewing in any Web browser"PRINT "0.abc for Mail-It, NOV*IX Mail, Onnet Mail"PRINT "pegasus.txt to import into Pegasus minus Office='Left Company' etc."PRINT "spry.als for Spry Air-Mail from Internet in a Box"PRINTLINE INPUT "Press ENTER to start..."; x$records = 0OPEN importfrom$ + ".csv" FOR INPUT AS #1OPEN "nndbase.txt" FOR OUTPUT AS #2OPEN "nndbase.my" FOR OUTPUT AS #3OPEN "address.htm" FOR OUTPUT AS #4OPEN "addrbook.htm" FOR OUTPUT AS #5OPEN "nndbase.pro" FOR OUTPUT AS #6OPEN "0.abc" FOR RANDOM AS #7 LEN = 190OPEN "pegasus.txt" FOR OUTPUT AS #8OPEN "spry.als" FOR OUTPUT AS #9PRINT #4, ""PRINT #4, ""PRINT #4, "Address book"PRINT #4, "

Address book

"PRINT #4, ""PRINT #4, "

"PRINT #5, ""PRINT #5, ""PRINT #5, "Mail Address book"PRINT #5, "

Mail Address book

"PRINT #5, "

UK : Mailing Groups

"PRINT #5, "

"PRINT #5, ""PRINT #5, "";PRINT #5, "";PRINT #5, "";PRINT #5, ""' Create empty record for Mail-It / Onnet / NOV*IX Mail format...header$ = CHR$(128) + STRING$(4, 0) + "(" + STRING$(4, 0) + CHR$(&HC0) + STRING$(6, 0) + "F" + STRING$(3, 0) + "" + STRING$(3, 0)record.dummy = header$record.email = STRING$(81, 0)record.fullname = STRING$(81, 0)DO UNTIL EOF(1) INPUT #1, Name$ INPUT #1, Dept$ INPUT #1, index$ INPUT #1, Office$ INPUT #1, dummy$ INPUT #1, email$ Dept$ = RTRIM$(Dept$) IF NOT EOF(1) THEN LINE INPUT #1, phone$ REM IF INSTR(email$, "@") = 0 THEN email$ = email$ + "@sol.ftp.com" email$ = LCASE$(email$) ' Write import.txt file to re-import into Pegasus.IF Office$ <> "Left Company" THEN PRINT #8, "Name: "; Name$ PRINT #8, "Of: "; Dept$ PRINT #8, "Key: "; index$ PRINT #8, "Street address: "; Office$ PRINT #8, "Postal address: "; dummy$ PRINT #8, "E-Mail address: "; CHR$(34); Name$; CHR$(34); " <"; email$; ">" PRINT #8, "Phone number: "; phone$ PRINT #8, "--" PRINT #8, ""END IF' Write Eudora Lite format file. PRINT #2, "alias " + CHR$(34) + Name$ + CHR$(34) + " " + email$ PRINT #2, "Note " + CHR$(34) + Name$ + CHR$(34) + " " + Office$ + " - " + Dept$; IF phone$ <> "." THEN PRINT #2, " - Phone : " + phone$ ELSE PRINT #2, ""' Write Eudora Format file (Malcolm Young) PRINT #3, "<" + Name$ + ">" PRINT #3, ">" + email$ PRINT #3, "<" + Name$ + ">" PRINT #3, ">" + Office$ + " " + Dept$; IF phone$ <> "." THEN PRINT #3, " - Phone : " + phone$ ELSE PRINT #3, ""' Eudora Pro V3.0 format (Mark Edwards) PRINT #6, "alias " + CHR$(34) + Name$ + CHR$(34) + " " + email$ PRINT #6, "note " + CHR$(34) + Name$ + CHR$(34) + " "; PRINT #6, ""; IF phone$ <> "." THEN PRINT #6, " "; PRINT #6, Dept$ ' Check for special case of first record when last office hasn't been filled IF lastoffice$ = "" THEN lastoffice$ = Office$' Check if office field has changed and write headers for HTML file if it has IF Office$ <> lastoffice$ THEN PRINT #5, "

Name

Phone No.

Email Address

Department / Job Function

" PRINT #5, "

" PRINT #5, "


" PRINT #5, "

" + Office$ + "

" IF Office$ = "UK : Solihull" THEN PRINT #5, "

Solihull extensions 3000-3099 are DDI numbers."; PRINT #5, " ( UK - 0121 703 + extension, International + 44 121 703 + extension )." PRINT #5, "

" PRINT #5, "Switchboard : 0121 703 3000
" PRINT #5, "Main Fax : 0121 711 4020" PRINT #5, "

" END IF PRINT #5, "" PRINT #5, ""; PRINT #5, ""; PRINT #5, ""; PRINT #5, "" END IF' Write .htm file lines for each record for Address.htm Netscape address book PRINT #4, "
" + Name$ + "" PRINT #4, "
" + Office$ + " - " + Dept$; IF phone$ <> "." THEN PRINT #4, " - Phone : " + phone$ ELSE PRINT #4, "" ' Write .html lines for straight html lookup doc. PRINT #5, "
"; PRINT #5, ""; PRINT #5, ""; PRINT #5, ""' Write records to 0.abc, fixed length file, for Mail-It & clones. record.dummy = header$ record.email = STRING$(81, 0) record.fullname = STRING$(81, 0) record.email = LEFT$(email$ + STRING$(81, 0), 81) record.fullname$ = LEFT$(Name$ + " (" + Office$ + " " + Dept$ + ")" + STRING$(81, 0), 81) PUT #7, records + 1, record' Spry Air Mail aliases file, spry.als.' Need to strip out all colon characters (:) as this is the seperator between' address and name. PRINT #9, StripChar$(Name$, ":", "-"); IF Office$ <> "" THEN FullDept$ = StripChar$(Office$, ":", "-") + " / " ELSE FullDept$ = "" END IF IF Dept$ <> "" THEN FullDept$ = FullDept$ + StripChar$(Dept$, ":", "-") IF FullDept$ <> "" THEN PRINT #9, " (" + FullDept$ + ")"; END IF PRINT #9, ":"; email$ records = records + 1 LOCATE 22, 1: PRINT USING "Records : ######"; records PRINT "Name : " + Name$ + "( " + email$ + " )" + " " lastoffice$ = Office$LOOPPRINT #4, "
"PRINT #4, "

"PRINT #4, "

"PRINT #5, "

Name

Phone No.

Email Address

Department / Job Function

"; PRINT #5, "" + Name$ + "" + phone$ + "" + email$ + "" + Dept$ + "
"PRINT #5, "
" CLOSE #1, #2, #3, #4, #5, #6, #7, #8, #9 FUNCTION StripChar$ (constr$, char$, replacewith$)'Skip through constr$ and replace all occurences of char$ with replacewith$Change$ = constr$DO charpos = INSTR(Change$, char$) IF charpos > 0 THEN MID$(Change$, charpos, 1) = replacewith$ END IFLOOP UNTIL charpos <= 0 StripChar$ = Change$ END FUNCTION