home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_books / vbbook12 / vbbinp12.frm (.txt) < prev    next >
Visual Basic Form  |  1993-03-09  |  20KB  |  444 lines

  1. VBBinp
  2. PC Book Input
  3. Form1
  4. Print Filename on each Page
  5. Do It
  6. Print Date/Time on each Page
  7. Print Page Numbers
  8. Cancel
  9. Cancel
  10. Use Speaker
  11. Set Line Wrap On
  12. Text1
  13. Text Width (Rec 75-80):
  14. Linelength
  15. Drive1
  16. File1
  17. Outname
  18. Output To:
  19. comboutname
  20. Picture1
  21. wwwwwwwwwwwwwwp
  22. wwwwwwwwwwwwwp
  23. Combooutname_Change
  24. go_click
  25. pcbook'
  26. Check1_Click
  27.     go2_clickN
  28. ptrarrayY
  29.     ErrorDept
  30. outfile\
  31.     JustCount#
  32. PC_LineLen,
  33. filename:
  34. PC_CurDateJ
  35. PC_DoHeadero
  36. PC_FileTitle{
  37. PC_PgNumber
  38. PC_LineWrap:
  39. OutHere
  40. GetName
  41. Title
  42. Default
  43. NewName.
  44. pcbinp
  45. BuildArray
  46. Pages
  47. KeyIn
  48. PrintSetupW
  49. LeftSide
  50.     RightSide
  51.     FirstPass
  52. DoPass
  53. Bookmark
  54. NextPage
  55. DoMacro
  56. LJLocate
  57. HeaderM
  58. Buffer3
  59.     NextPage1a
  60. WaitKey
  61. abort
  62. PrtReset
  63. ERDEV
  64. AWayOut
  65. Flags
  66. pgcount@
  67. MaxLines
  68. Offset
  69.     TotalSize
  70. FileLeft
  71. MemAvail
  72. SixteenK
  73. BufAvail
  74. BuffSizeJ
  75. LnCount
  76. GetPage
  77. stptr
  78. LastLineT
  79.     PageCheck
  80. TempLn|
  81. temppg
  82.     PageBreak6
  83. EndBuild}
  84. Label1_load
  85. EndMacro
  86. PTemp
  87. @    printlogo
  88. StartMacro
  89. Form_Click
  90. Dir1_Change
  91. file1
  92. patht
  93. Dir1_Click}
  94. lastchange
  95. dirsboxclick>
  96. fileboxclickb
  97. File1_ClickM
  98. frame1
  99. caption
  100. File1_DblClick
  101. button_Click
  102. button
  103. index
  104.     listindex@
  105. drive1l
  106. drive
  107. inname
  108. Inname_DragDrop
  109. Source
  110. clk1_Click
  111. clk2_Click
  112. clk3_Click
  113. clk4_ClickU
  114. clk5_Clickg
  115. Outname_DragDropb
  116.     PCBOUTPUT
  117.     scroutput
  118. PCBOUT
  119. Drive1_Change
  120. Cancel_Click
  121. comboutname_Change
  122. @    Form_Load
  123. comboutname
  124. comboutname_Click
  125. comoutname
  126. Click>
  127. abortit
  128. Dennisi
  129. Scott,
  130. ustCountP
  131. lengthW
  132. padspc
  133. Functionpad
  134. msglen
  135. Picture1_Click
  136. VBBinp
  137. vbbout
  138. PCLineWrap
  139.     PCLinelen
  140. PCFileTitle
  141. PCPgNumber
  142.     PCCurDate
  143. PCDoHeader
  144. false
  145. value
  146. comboutname_GotFocus
  147. comboutname_LostFocus
  148. LineWrap
  149. Linelen
  150.     FileTitle
  151. PgNumber
  152. CurDate
  153. DoHeader
  154. Linelength_Change
  155. Linelength_Click
  156. Linelength
  157. tempmrg
  158. Status
  159. Staus
  160. fontitalic
  161. BuildArray
  162. Maximum number of lines)
  163. Start of file (seek point)
  164. Open file to check
  165. Get LEN of file so we don't read too far
  166. Setup a counter to show whats left
  167. FRE is not supported by VB.  Just set it to 64Kb
  168. FRE(FileName$) - 2048
  169.  'Check available string memory
  170. Force out of memory error
  171. Set a buffer sizer
  172. If the file is larger than 16K
  173. Set it to 16ks
  174. Otherwise set it to file sizeo
  175. Initialize page counts
  176. First pointer is always 1a
  177. Initialize line countl
  178. Read the filea
  179. Check amount left to readl
  180. If less than our buffer, use lessor
  181. Otherwise use full buffer size
  182. Read in a buffers worthf
  183. Pointer into buffer$
  184. remember last position
  185. Position of next linefeeds
  186. Position of next pagefeeds
  187. If there was a page feed
  188.   was it before our linefeed?r
  189.   yes then bump page count
  190.   set next array element
  191.   set instr pointer 
  192.   reset linecountf
  193. and loop back for more
  194. Linefeed
  195. If Line Wrap, check length
  196. Greater than 80?
  197. check for line wrapr
  198. increment line
  199. > 66 lines
  200. Increment page count
  201. Too may pages - printing only 512.
  202. Notice
  203. point to next in point in file
  204. point ahead 1 byte for next scan
  205. keep checking 
  206. Pointer into file (tally)n
  207. Reset Buffer pointer
  208. Calculate how much is left
  209. If more text in file, keep going
  210. Set last pointer to end of fileg
  211. Close input file
  212. End of BuildArray Sub 
  213. Label1_load
  214. This section is not used at this timee
  215. PCBook - PC Magazine Booklet Printing Utility"u
  216. Copyright 1990 PC Magazine  Ziff Davis  Jay Munro"u
  217. Converted to Visual Basic by Dennis Scott"u
  218. DoMacro
  219. y2X"t
  220. execute the macro
  221. EndMacro
  222. y1X"t
  223. Send end of macro command 
  224. y9X"t
  225. Make it temporary (10 to be permanent)
  226. Header
  227. Create a string to print
  228. Print the filename
  229. Print the current page
  230. odd page, right side
  231. even page, left side
  232. Print the current date
  233. even page, left side
  234. odd page, right side
  235. Print the Header
  236.  and skip a line for readability
  237. LJLocate
  238. Laser Jet cursor locatee
  239. printlogo
  240. Banner logo
  241.              VB Book Ver 1.2
  242.      Converted to Visual Basic
  243.              by Dennis Scott."
  244. Send Comments/Suggestions to:"
  245.                CompuDirect
  246.              7711 Butler Road"
  247.              Myrtle Beach, SC"
  248.                (803)650-7460
  249. About VB Book"
  250. PrintSetup
  251. Send codes to prepare printerd
  252. Reset laserjet (simple isn't it!)r
  253. &l1o5.45C"t
  254. Select lineprinter font"
  255. (s0p16.66Ht
  256.   and pitchp
  257. &l0Lt
  258. Turn off page feed at 66 lines
  259. Wrap lines > 80 chars 
  260. &s0Ct
  261. &l2Et
  262. Top margin 2 lines
  263. Left side macro
  264. Reset left - right margins
  265. set left margin 0, right Line Length
  266. Right side macro
  267. Reset left - right margins
  268. l175M"
  269. set left margin, right 175
  270. StartMacro
  271. Macro will have an id of Num$ 
  272. &f0Xt
  273. Start the macro nowr
  274. Form_Click
  275. If user clicks on the form, call the about box
  276. go_click
  277. This is the main code - everything is actually called from here
  278. Code for Drive, Directory, and File selections
  279. Sorry!  You must first select a file."
  280. No application chosen.
  281. cancel buttonc
  282. total number of pages (512) 
  283. Error trapping
  284. Ensure that we have a file name (user may have clicked DoIt withoutt
  285. entering a filename)
  286. Enter a file name to print: 
  287. Filename
  288.  Set title.n
  289.  Get user input.
  290.  Check if valid.
  291. You did not input a valid Filename."
  292. Click on OK to End Program
  293.  Display message. 
  294. Build index array for pages in FileName$
  295. Done with main form so show Status from and provide updatesa
  296. Reading file: t
  297. Built pointer arrayF
  298. Figure number of pages neededn
  299. Even multiples of 4 only
  300.   correct for less
  301. You will printt
  302. sheets."u
  303. Report total number of pages
  304. sheet.u
  305. JustCount% is set to false alwaysw
  306. Press any key to continue, or ESC to cancel printingu
  307. Open printer or output file
  308. Set up printer
  309. Page parsing variables
  310. Open the input filep
  311. Printing Side 1 to: t
  312. Track what is going on
  313. Status.Print
  314. Start of print routine
  315. Flag for halfway through
  316. Force 1 if too small
  317. Read text and send to printer or file;
  318. Print the right side of the page first
  319. If blank, then skip it
  320. Start on right siden
  321. Header if needed
  322. Read in a page
  323. If the last character is a PFt
  324. print only texth
  325. Otherwise print full liney
  326. Don't print blank pages
  327. Reset margins for left sidee
  328. Home the cursorg
  329. Header if needed
  330. Setup buffer for input
  331. If pointing at blank page, skipr
  332. Read in a page
  333. if the last character is a PFr
  334. print only texti
  335. print only text
  336. otherwise print alln
  337. Page feed 
  338. Calculate next page in seriesi
  339. Track our progress
  340. Print pages until halfway throught
  341. Pause between sides to allow for paper reinsertion
  342. If side one, prompt and get 2nd side
  343. Flag for second pass
  344. First Pass has been Completed.
  345. Insert paper back in tray and Click OK."
  346. (Or cancel to end program.)"
  347. Continue?"
  348. cancel button
  349. Reset printer and end program
  350. Report on progress
  351. Printing Side 2 to: t
  352. End of first passS
  353. Printing is done now
  354. Printing completed.  Ending Program"
  355. Reset laserjet
  356. Close all files"
  357. Thats all for noww
  358. Error handlero
  359. *** Error ***"
  360. Printer error.
  361. Device is unavailable.
  362. Insert a disk in the drive and close the door.
  363. Device Input/Output Error (Check Printer!)."
  364. Disk is full."
  365. That filename is illegal."
  366. That path doesn't exist.
  367. Can't open your file for that type of access."
  368. This file is already open.
  369. This file has a nonstandard end-of-file marker
  370. or an attempt was made to read beyond the end-
  371. of-file marker."
  372. Error number "
  373. ERROR"
  374. If user presses Cancel, Exit
  375. End of main module
  376. Dir1_Change
  377. Dir1_Click
  378. File1_Click
  379. use the following line to put filename in framef
  380. if using a frame: 
  381. inname.caption = "Load " + file1.filenamee
  382. File1_DblClick
  383. clk1_Click
  384. Toggle on/offe
  385. Still have to do the Header if clk2 or clk3 buttons are checked
  386. clk2_Click
  387. Toggle on/offT
  388. Still have to do the Header if clk1 or clk3 buttons are checked
  389. clk3_Click
  390. Toggle on/offT
  391. Still have to do the Header if clk1 or clk2 buttons are checked
  392. clk4_Click
  393. Toggle on/offT
  394. clk5_Click
  395. Toggle on/offT
  396. Drive1_Change
  397. Cancel_Click
  398. If user clicks on the cancel button then ...
  399. Form_Load
  400. Set up the output combo boxo
  401. default to LPT1e
  402. Set up the Line Length combo box
  403. default to 80T
  404. default to line length of 80
  405. default to right side left margin of 95t
  406. set default check-box values
  407. set some variables
  408. Standard ESC codet
  409. Page Feed
  410. Line Feed 
  411. CR and LFd
  412. Not allowing "just counting"
  413.  PC.Linelen = 80
  414.  'Maximum length of line
  415. comboutname_Click
  416. Select where to send the output
  417. LPT1&
  418. LPT2&
  419. COM1&
  420. COM2&
  421. file&
  422. You must select an input filename first!
  423. set focus to file list box
  424. Now make up a default output filename with same name and PRN as extensionn
  425. Enter filename to print to:"
  426. Output File Name
  427. Get a filename
  428. put filename in combo boxU
  429. set focus to file list box
  430. Picture1_Click
  431. Show the "about" box
  432. Linelength_Click
  433. Allow line lengths upto 80
  434. We prevent the line length from being over 80 with Linelength.Change
  435. convert string to number
  436. Compute temp right margint
  437. values are (PC.Linelen,PC.tempmrg): 80,95; 75,100; 70,105; 65,1105
  438. of course values will be different for other line lengthsn
  439. Linelength_Change
  440. Prevent the user from entering a value over 80
  441. If the user just typed the value into the box then compute it here
  442. convert string to number
  443. Compute temp right margint
  444.