home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / wp / vbbook13.zip / VBBINP13.FRM (.txt) < prev    next >
Visual Basic Form  |  1993-04-04  |  23KB  |  508 lines

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