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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>procedure Instruct3Button_onClick=20
()<BR>&nbsp;&nbsp;&nbsp; integer handle, in, out, i, x, found,=20
lastfound<BR>&nbsp;&nbsp;&nbsp; sequence fName, temp,=20
result<BR>&nbsp;&nbsp;&nbsp; object data, new, =
new1<BR>&nbsp;&nbsp;&nbsp; -- get=20
the file name<BR>&nbsp;&nbsp;&nbsp; fName =3D getOpenFileName( =
SafeWindow,=20
current_dir() &amp; "<A href=3D"file://\\*">\\*</A>.3in", FileType3=20
)<BR>&nbsp;&nbsp;&nbsp; found=3D0<BR>&nbsp;&nbsp;&nbsp; lastfound =3D=20
1<BR>&nbsp;&nbsp;&nbsp; if length( fName ) =3D 0=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
return<BR>&nbsp;&nbsp;&nbsp;=20
end if<BR>&nbsp;&nbsp;&nbsp; result =3D getPrinter()&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; -- select printer I think but doesn't seem to get =
this=20
far<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setText(StatusBar1, =
"result =3D=20
" &amp; result )<BR>&nbsp;&nbsp;&nbsp; if length(result)=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setText(StatusBar1,=20
"Printing" )<BR>&nbsp;&nbsp;&nbsp; if not startDoc(fName) =
then&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- start=20
doc<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return<BR>&nbsp;&nbsp;&nbsp; end=20
if<BR>&nbsp;&nbsp;&nbsp; if not startPage() then&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp; --=20
start page<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
return<BR>&nbsp;&nbsp;&nbsp; end=20
if<BR>&nbsp;&nbsp;&nbsp; in =3D open( fName, "r" )<BR>&nbsp;&nbsp;&nbsp; =
while 1=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data =3D gets( in=20
)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if atom( data )=20
exit<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end =
if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
i =3D match("{", data)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while i &gt; 0=20
do<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if i &gt; 0=20
then<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i =3D =
match("{1}",=20
data)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if i =
&gt; 0=20
; new =3D=20
data[1..i-1] &amp; sprint(theNumbers[3]) &amp; data[i +=20
;&nbsp;&nbsp;=20
data =3D new<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
end=20
if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i =3D =
match("{2}",=20
data)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if i =
&gt; 0=20
; new =3D=20
data[1..i-1] &amp; sprint(theNumbers[2]) &amp; data[i +=20
;&nbsp;&nbsp;=20
data =3D new<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
end=20
if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i =3D =
match("{3}",=20
data)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if i =
&gt; 0=20
; new =3D=20
data[1..i-1] &amp; sprint(theNumbers[1]) &amp; data[i +=20
;&nbsp;&nbsp;=20
data =3D new<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
end=20
if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end=20
if<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end =
while<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
wPuts( Printer, data)&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- send line to =

printer<BR>&nbsp;&nbsp;&nbsp; end while<BR>&nbsp;&nbsp;&nbsp;=20
close(in)<BR>&nbsp;&nbsp;&nbsp; close(out)<BR>&nbsp;&nbsp;&nbsp;=20
setText(StatusBar1, "File Created" )<BR>&nbsp;&nbsp;&nbsp; if not =
endDoc()=20
then&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- end=20
doc<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return<BR>&nbsp;&nbsp;&nbsp; end=20
if<BR>&nbsp;&nbsp;&nbsp; releasePrinter()&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;=20
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -- release=20
printer<BR>&nbsp;&nbsp;&nbsp; end if</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>end =

------=_NextPart_000_0007_01C056FA.036160A0--

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu