home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / vrac / qwsample.zip / TXT2PHN.SCR < prev   
Text File  |  1994-01-11  |  2KB  |  62 lines

  1. ' This script will prompt for a text file to import into the current phone
  2. ' book.  The default column positions are appropriate for MSI's WCLIST.TXT
  3. ' listing of Wildcat! BBS systems.  The numbers will have to be changed for
  4. ' other BBS listings.
  5.  
  6. dialog FilenameDialog 100, 100, 200, 130
  7.   caption "Import text file to phonebook"
  8.   groupbox "", -1, 5, 5, 190, 91
  9.   ltext "Input file", -1, 10, 16, 40, 12
  10.   InputFile as edittext 101, 50, 15, 130, 12
  11.   pushbutton "&View file...", 110, 90, 30, 50, 14
  12.   ltext "System name start column", -1, 10, 56, 90, 12
  13.   SystemStart as edittext 102, 110, 55, 20, 12
  14.   ltext "length", -1, 140, 56, 20, 12
  15.   SystemLength as edittext 103, 170, 55, 20, 12
  16.   ltext "Phone number start column", -1, 10, 76, 90, 12
  17.   NumberStart as edittext 104, 110, 75, 20, 12
  18.   ltext "length", -1, 140, 76, 20, 12
  19.   NumberLength as edittext 105, 170, 75, 20, 12
  20.   defpushbutton "OK", IDOK, 40, 105, 50, 14
  21.   pushbutton "Cancel", IDCANCEL, 110, 105, 50, 14
  22. end dialog
  23.  
  24. function FilenameDialog.id(110) as integer
  25.   viewfile InputFile
  26. end function
  27.  
  28. dim fd as FilenameDialog
  29. dim sstart as integer
  30. dim slength as integer
  31. dim nstart as integer
  32. dim nlength as integer
  33. dim entry as PhoneEntry
  34.  
  35. fd.SystemStart = "15"
  36. fd.SystemLength = "25"
  37. fd.NumberStart = "1"
  38. fd.NumberLength = "12"
  39. if dialogbox(fd) = IDCANCEL then end
  40.  
  41. sstart = val(fd.SystemStart)
  42. slength = val(fd.SystemLength)
  43. nstart = val(fd.NumberStart)
  44. nlength = val(fd.NumberLength)
  45.  
  46. open fd.InputFile for input as #1
  47. print "Importing...";
  48. do while not eof(1)
  49.   dim s as string
  50.   input #1, s
  51.   entry.systemname = rtrim(mid(s, sstart, slength))
  52.   entry.number(1) = rtrim(mid(s, nstart, nlength))
  53.   entry.Emulation = ANSI
  54.   entry.Protocol = Zmodem
  55.   addentry entry
  56.   print ".";
  57. loop
  58. print
  59. close #1
  60.  
  61. catch err_fileopen
  62.   MsgBox "Unable to open file "+fd.InputFile