1. Can't Print
------=_NextPart_000_0007_01C056FA.036160A0
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I'm trying to print a sequence to the printer using win32lib V0.50c
Below is a snapshot if my prog i'm not sure whats wrong with it but it =
doesn't seem to work. i presume getPrinter allows you to select printer =
but it doesnt get to that line
procedure Instruct3Button_onClick ()
integer handle, in, out, i, x, found, lastfound
sequence fName, temp, result
object data, new, new1
-- get the file name
fName =3D getOpenFileName( SafeWindow, current_dir() & "\\*.3in", =
FileType3 )
found=3D0
lastfound =3D 1
if length( fName ) =3D 0 then
return
end if
result =3D getPrinter() -- =
select printer I think but doesn't seem to get this far
setText(StatusBar1, "result =3D " & result )
if length(result) then
setText(StatusBar1, "Printing" )
if not startDoc(fName) then -- start doc
return
end if
if not startPage() then -- start =
page
return
end if
in =3D open( fName, "r" )
while 1 do
data =3D gets( in )
if atom( data ) then
exit
end if
i =3D match("{", data)
while i > 0 do
if i > 0 then
i =3D match("{1}", data)
if i > 0 then
new =3D data[1..i-1] & sprint(theNumbers[3]) & data[i + =
3..length(data)]
data =3D new
end if
i =3D match("{2}", data)
if i > 0 then
new =3D data[1..i-1] & sprint(theNumbers[2]) & data[i + =
3..length(data)]
data =3D new
end if
i =3D match("{3}", data)
if i > 0 then
new =3D data[1..i-1] & sprint(theNumbers[1]) & data[i + =
3..length(data)]
data =3D new
end if
end if
end while
wPuts( Printer, data) -- send line to =
printer
end while
close(in)
close(out)
setText(StatusBar1, "File Created" )
if not endDoc() then -- end doc
return
end if
releasePrinter() -- release =
printer
end if
end procedure
------=_NextPart_000_0007_01C056FA.036160A0
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2614.3500" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I'm trying to print a sequence to the =
printer using=20
win32lib V0.50c</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Below is a snapshot if my prog i'm not =
sure whats=20
wrong with it but it doesn't seem to work. i presume getPrinter allows =
you to=20
select printer but it doesnt get to that line</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>procedure Instruct3Button_onClick=20
()<BR> integer handle, in, out, i, x, found,=20
lastfound<BR> sequence fName, temp,=20
result<BR> object data, new, =
new1<BR> -- get=20
the file name<BR> fName =3D getOpenFileName( =
SafeWindow,=20
current_dir() & "<A href=3D"file://\\*">\\*</A>.3in", FileType3=20
)<BR> found=3D0<BR> lastfound =3D=20
1<BR> if length( fName ) =3D 0=20
then<BR> =
return<BR> =20
end if<BR> result =3D getPrinter() =20
=
=20
=
=20
-- select printer I think but doesn't seem to get =
this=20
far<BR> setText(StatusBar1, =
"result =3D=20
" & result )<BR> if length(result)=20
then<BR> setText(StatusBar1,=20
"Printing" )<BR> if not startDoc(fName) =
then =20
=
=20
-- start=20
doc<BR> return<BR> end=20
if<BR> if not startPage() then =20
=
=20
=
--=20
start page<BR> =
return<BR> end=20
if<BR> in =3D open( fName, "r" )<BR> =
while 1=20
do<BR> data =3D gets( in=20
)<BR> if atom( data )=20
exit<BR> end =
if<BR> =20
i =3D match("{", data)<BR> while i > 0=20
do<BR> if i > 0=20
then<BR> i =3D =
match("{1}",=20
data)<BR> if i =
> 0=20
; new =3D=20
data[1..i-1] & sprint(theNumbers[3]) & data[i +=20
; =20
data =3D new<BR> =
end=20
if<BR> i =3D =
match("{2}",=20
data)<BR> if i =
> 0=20
; new =3D=20
data[1..i-1] & sprint(theNumbers[2]) & data[i +=20
; =20
data =3D new<BR> =
end=20
if<BR> i =3D =
match("{3}",=20
data)<BR> if i =
> 0=20
; new =3D=20
data[1..i-1] & sprint(theNumbers[1]) & data[i +=20
; =20
data =3D new<BR> =
end=20
if<BR> end=20
if<BR> end =
while<BR> =20
wPuts( Printer, data) =
=20
-- send line to =
printer<BR> end while<BR> =20
close(in)<BR> close(out)<BR> =20
setText(StatusBar1, "File Created" )<BR> if not =
endDoc()=20
then =
=20
-- end=20
doc<BR> return<BR> end=20
if<BR> releasePrinter() =
=20
=
=20
-- release=20
printer<BR> end if</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>end =
------=_NextPart_000_0007_01C056FA.036160A0--