home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Breakthrough: Utilities & Productivity
/
SharewearBreakthroughUtil_ProdCol.cdr
/
util
/
vbbook
/
vbbinp.frm
(
.txt
)
next >
Wrap
Visual Basic Form
|
1991-09-06
|
19KB
|
423 lines
VBBinp
PC Book Input
Form1
Print Filename on each Page
Do It
Print Date/Time on each Page
Print Page Numbers
Cancel
Cancel
Use Speaker
Set Line Wrap On
Drive1
File1
Outname
Output To:
comboutname
Picture1
wwwwwwwwwwwwwwp
wwwwwwwwwwwwwp
Combooutname_Change
go_click
pcbook'
Check1_Click
go2_clickN
ptrarrayY
ErrorDept
OUTFILE\
JustCount#
PC_LineLen,
filename:
PC_CurDateJ
PC_DoHeadero
PC_FileTitle{
PC_PgNumber
PC_LineWrap:
OutHere
GetName
Title
Default
NewName.
pcbinp
BuildArray
pages
KeyIn
PrintSetupW
LeftSide
RightSide
FirstPass
DoPass
Bookmark
NextPage
DoMacro
LJLocate
HeaderM
Buffer3
NextPage1a
WaitKey
abort
PrtReset
ERDEV
AWayOut
Flags
pgcount@
MaxLines
Offset
TotalSize
FileLeft
MemAvail
SixteenK
BufAvail
BuffSizeJ
LnCount
GetPage
stptr
LastLineT
PageCheck
TempLn|
temppg
PageBreak6
EndBuild}
Label1_load
EndMacro
PTemp
@ printlogo
StartMacro
Form_Click
Dir1_Change
file1
patht
Dir1_Click}
lastchange
dirsboxclick>
fileboxclickb
File1_ClickM
frame1
caption
File1_DblClick
button_Click
button
index
listindex@
drive1l
drive
inname
Inname_DragDrop
Source
clk1_Click
clk2_Click
clk3_Click
clk4_ClickU
clk5_Clickg
Outname_DragDropb
PCBOUTPUT
scroutput
PCBOUT
Drive1_Change
Cancel_Click
comboutname_Change
@ Form_Load
comboutname
comboutname_Click
comoutname
Click>
abortit
Dennisi
Scott,
ustCountP
lengthW
padspc
Functionpad
msglen
Picture1_Click
VBbinp
vbbout
PCLineWrap
PCLineLen
PCFileTitle
PCPgNumber
PCCurDate
PCDoHeader
false
value
comboutname_GotFocus
comboutname_LostFocus
LineWrap
LineLen
FileTitle
PgNumber
CurDate
DoHeader
BuildArray
Maximum number of lines)
Start of file (seek point)
Open file to check
Get LEN of file so we don't read too far
Setup a counter to show whats left
FRE is not supported by VB. Just set it to 64Kb
FRE(FileName$) - 2048
'Check available string memory
Force out of memory error
Set a buffer sizer
If the file is larger than 16K
Set it to 16ks
Otherwise set it to file sizeo
Initialize page counts
First pointer is always 1a
Initialize line countl
Read the filea
Check amount left to readl
If less than our buffer, use lessor
Otherwise use full buffer size
Read in a buffers worthf
Pointer into buffer$
remember last position
Position of next linefeeds
Position of next pagefeeds
If there was a page feed
was it before our linefeed?r
yes then bump page count
set next array element
set instr pointer
reset linecountf
and loop back for more
Linefeed
If Line Wrap, check length
Greater than 80?
check for line wrapr
increment line
> 66 lines
Increment page count
Too may pages - printing only 512.
Notice
point to next in point in file
point ahead 1 byte for next scan
keep checking
Pointer into file (tally)n
Reset Buffer pointer
Calculate how much is left
If more text in file, keep going
Set last pointer to end of fileg
Close input file
End of BuildArray Sub
Label1_load
This section is not used at this timee
PCBook - PC Magazine Booklet Printing Utility"u
Copyright 1990 PC Magazine Ziff Davis Jay Munro"u
Converted to Visual Basic by Dennis Scott"u
DoMacro
y2X"t
execute the macro
EndMacro
y1X"t
Send end of macro command
y9X"t
Make it temporary (10 to be permanent)
Header
Create a string to print
Print the filename
Print the current page
odd page, right side
even page, left side
Print the current date
even page, left side
odd page, right side
Print the Header
and skip a line for readability
LJLocate
Laser Jet cursor locatee
printlogo
Banner logo
VB Book
Converted to Visual Basic
by Dennis Scott."
Send Comments/Suggestions to:"
CompuDirect
9102 Ocean Gate
San Antonio, TX"
(512)623-6856
About VB Book"
PrintSetup
Send codes to prepare printerd
Reset laserjet (simple isn't it!)r
&l1o5.45C"t
Select lineprinter font"
(s0p16.66Ht
and pitchp
&l0Lt
Turn off page feed at 66 lines
Wrap lines > 80 chars
&s0Ct
&l2Et
Top margin 2 lines
Left side macro
Reset left - right margins
&a0l80M"t
set left margin 0, right 80
Right side macro
Reset left - right margins
&a95l175M"t
set left margin 95, right 175
StartMacro
Macro will have an id of Num$
&f0Xt
Start the macro nowr
Form_Click
If user clicks on the form, call the about box
go_click
This is the main code - everything is actually called from here
Code for Drive, Directory, and File selections
Sorry! You must first select a file."
No application chosen.
cancel buttonc
total number of pages (512)
Error trapping
Ensure that we have a file name (user may have clicked DoIt withoutt
entering a filename)
Enter a file name to print:
Filename
Set title.n
Get user input.
Check if valid.
You did not input a valid Filename."
Click on OK to End Program
Display message.
FOR TESTING:
PC.LineWrap = 0p
Build index array for pages in FileName$
Have not converted status display
Print
Print "Reading file "; filename$
Built pointer arrayF
Figure number of pages neededn
Even multiples of 4 only
correct for less
Have not converted status display
Printn
Print "You will print "; Page% \ 4; "sheets" 'Report total number of pages
Print
JustCount% is set to false always due to status section not beinge
converted to VBe
Press any key to continue, or ESC to cancel printingu
Open printer or output file
Set up printer
Page parsing variables
Open the input filep
Have not converted status displayi
Print "Printing Side 1 to "; outfile$;
'Track what is going on
Start of print routine
Flag for halfway through
Force 1 if too small
Read text and send to printer or file;
Print the right side of the page first
If blank, then skip it
Start on right siden
Home the cursorg
Header if needed
Read in a page
If the last character is a PFt
print only texth
Otherwise print full liney
Don't print blank pages
Reset margins for left sidee
Home the cursorg
Header if needed
Setup buffer for input
If pointing at blank page, skipr
Read in a page
if the last character is a PFr
print only texti
print only text
otherwise print alln
Page feed
Calculate next page in seriesi
Track our progress
Print pages until halfway throught
Pause between sides to allow for paper reinsertion
If side one, prompt and get 2nd side
First Pass has been Completed.
Insert paper back in tray and Click OK
Press any key to continue loop
Waiting"
Flag for second pass
Have not converted status display
msg$ = "Printing Side 2 to " + outfile$t
Print msg$
'Report on progress
End of first pass
Printing is done now
Printing completed."
Reset laserjet
Close all files"
Thats all for noww
Error handlero
*** Error ***"
Printer error.
Device is unavailable.
Insert a disk in the drive and close the door.
Device Input/Output Error (Check Printer!)."
Disk is full."
That filename is illegal."
That path doesn't exist.
Can't open your file for that type of access."
This file is already open.
This file has a nonstandard end-of-file marker
or an attempt was made to read beyond the end-
of-file marker."
Error number "
ERROR"
If user presses Cancel, Exit
End of main module
Dir1_Change
Dir1_Click
File1_Click
use the following line to put filename in framef
if using a frame:
inname.caption = "Load " + file1.filenamee
File1_DblClick
clk1_Click
Toggle on/offe
Still have to do the Header if clk2 or clk3 buttons are checked
clk2_Click
Toggle on/offT
Still have to do the Header if clk1 or clk3 buttons are checked
clk3_Click
Toggle on/offT
Still have to do the Header if clk1 or clk2 buttons are checked
clk4_Click
Toggle on/offT
clk5_Click
Toggle on/offT
Drive1_Change
Cancel_Click
If user clicks on the cancel button then ...
Form_Load
Set up the output combo boxo
default to LPT1e
set default check-box values
set some variables
Standard ESC codet
Page Feed
Line Feed
CR and LFd
Not allowing "just counting"
Maximum length of line
comboutname_Click
Select where to send the output
LPT1&
LPT2&
COM1&
COM2&
file&
You must select an input filename first!
set focus to file list box
Now make up a default output filename with same name and PRN as extensionn
Enter filename to print to:"
Output File Name
Get a filename
put filename in combo boxU
set focus to file list box
Picture1_Click
Show the "about" box