home *** CD-ROM | disk | FTP | other *** search
/ PDA Software Library / pdasoftwarelib.iso / PILOT / support / DOC2PRC / DOC2PRC.ZIP / doc2prc.txt next >
Encoding:
Text File  |  1997-04-11  |  1.9 KB  |  64 lines

  1. 'Word v6.0 macro to convert the open document into .PRC format for
  2. 'use by DOC for the Pilot, written by Rick Bram
  3. 'This macro needs a completely blank tempate called "etext.dot"
  4.  
  5. 'Created April 1997 by D A MacLeod, davmac@bigfoot.com
  6.  
  7. Sub MAIN
  8.  
  9. 'file locations
  10. MakeDoc$ = "c:\pilot\add-on\makedoc7.exe"
  11. InstApp$ = "c:\pilot\instapp.exe"
  12. TempDoc$ = "c:\temp\fred.txt"
  13. SaveDoc$ = "c:\pilot\add-on\"
  14.  
  15. 'Get information about what to call the PRC file, where to put it and 
  16. 'a descriptive name for the document
  17.  
  18. Begin Dialog UserDialog 445, 145, "Convert and Install on Pilot"
  19.     TextBox 165, 15, 250, 18, .DocName
  20.     TextBox 165, 35, 250, 18, .Path
  21.     TextBox 165, 55, 150, 18, .FileName
  22.     Text 28, 18, 125, 13, "Document Name", .legDocName
  23.     Text 28, 38, 36, 13, "Path", .txtPath
  24.     Text 28, 58, 76, 13, "File Name", .txtFileName
  25.     OKButton 330, 80, 90, 21
  26.     CancelButton 330, 105, 90, 21
  27. End Dialog
  28.  
  29. Dim dlg As UserDialog
  30. dlg.Path = "c:\pilot\add-on\"
  31.  
  32. On Error Goto Done
  33. Dialog dlg
  34. On Error Goto 0
  35.  
  36. 'Select everything in the current document, create a new document,
  37. 'based on etext.dot and copy everything in
  38. EditSelectAll
  39. EditCopy
  40. FileNew .Template = "Etext", .NewTemplate = 0
  41. EditPaste
  42.  
  43. 'Save the data in .TXT format
  44. FileSaveAs .Name = TempDoc$, .Format = 2, .LockAnnot = 0, .Password = "", .AddToMru = 0, .WritePassword = "", .RecommendReadOnly = 0, .EmbedFonts = 0, .NativePictureFormat = 0, .FormsData = 0
  45. FileClose 2
  46.  
  47. 'Start makedoc
  48. Shell MakeDoc$ + " " + TempDoc$ + " " + dlg.Path + dlg.FileName + ".prc " + Chr$(34) + dlg.DocName + Chr$(34), 0
  49.  
  50. 'Wait until makedoc has finished
  51. WaitMsg$ = "Converting " + dlg.DocName
  52. While AppIsRunning("makedoc")
  53.     WaitMsg$ = WaitMsg$ + "."
  54.     Print WaitMsg$
  55.     For Delay = 1 To 100
  56.     Next Delay
  57. Wend
  58.  
  59. 'Run the Pilot installation process
  60. Shell InstApp$ + " " + dlg.Path + dlg.FileName + ".prc", 1
  61.  
  62. Done:
  63.  
  64. End Sub