Loading ...
Sorry, an error occurred while loading the content.
 

RE: printdialog clone

Expand Messages
  • rod_bird001
    Well yes, if you run the fragment, but the supplied code simply ran the function and ended. That works. To run the whole program we would need to have the
    Message 1 of 5 , Sep 17, 2013

      Well yes, if you run the fragment, but the supplied code simply ran the function and ended. That works. To run the whole program we would need to have the whole program. 



      --- In libertybasic@yahoogroups.com, <john_siejkowski@...> wrote:

      The program crashes at this line as the branch label does not exist:

       

      if numb = 0 then goto [main.inputLoop]

       

       



      --- In libertybasic@yahoogroups.com, <libertybasic@yahoogroups.com> wrote:

      Hi,

       

      I am running a racing program, in which I am trying to use the printdialog clone code to select a printer to print my reports. Everytime I click ok I receive a message that lists my handles, and say they were closed by Liberty Basic, please add the appropriate close commands. Before I add the clone code everything was fine. Below is part of my code with the clone code.

       

      Any help would be appreciated.

       

      Thanks,

      Mike

       

       

      [print2race]

      'PRINTERDIALOG
      DefaultPrinterName$=DefaultPrinterName$()
          gosub [SelectPrinter]
          end

      racenum = 1

      goto [select]

      [printrace2]

      racenum = 2

      goto [select]

      [printrace3]

      racenum = 3

      goto [select]

      [printrace4]

      racenum = 4

      goto [select]

      [printrace5]

      racenum = 5

      goto [select]

      [printrace6]

      racenum = 6

      goto [select]

      [printrace7]

      racenum = 7

      goto [select]

      [printrace8]

      racenum = 8

      goto [select]

      [printrace9]

      racenum = 9

      goto [select]

      [printrace10]

      racenum = 10

      goto [select]

      [printrace11]

      racenum = 11

      goto [select]

      [printrace12]

      racenum = 12

      goto [select]

      [printrace13]

      racenum = 13

      goto [select]

      [printrace14]

      racenum = 14

      goto [select]


      [select]
      didcsv=0 'flag so only create csv one time per race
           Select Case racenum
                  case 1
                  numb = Rone
                  marker = 1
                  case 2
                  numb = Rtwo
                  marker = Rone + 1
                  case 3
                  numb = Rthree
                  marker =  Rtwo + Rone + 1
                  case 4
                  numb = Rfour
                   marker = Rthree + Rtwo + Rone + 1
                  case 5
                  numb = Rfive
                  marker = Rfour + Rthree + Rtwo + Rone + 1
                  case 6
                  numb = Rsix
                  marker = Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 7
                  numb = Rseven
                  marker = Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 8
                  numb = Reight
                   marker = Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 9
                  numb = Rnine
                  marker = Reight + Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 10
                  numb = Rten
                  marker = Rnine + Reight + Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 11
                  numb = Releven
                  marker = Rten + Rnine + Reight + Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 12
                  numb = Rtwelve
                  marker = Releven + Rten + Rnine + Reight + Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 13
                  numb = r13
                  marker = Rtwelve + Releven + Rten + Rnine + Reight + Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  case 14
                  numb = r14
                  marker = r13 + Rtwelve + Releven + Rten + Rnine + Reight + Rseven + Rsix + Rfive + Rfour + Rthree + Rtwo + Rone + 1
                  end select

      if numb = 0 then goto [main.inputLoop]

      GETTRIM #race1, racenum 'have to grab data again when switching races

      Dim Classtest(25,3) ' an array for new class rating

      mount = marker

      for f = 0 to numb-1
      GETTRIM #horse1, mount

      'print "Race distance: ";todaysdistance
      name$(f) = HorseName$
      saddle$(f) = space$(2-len(Saddlecloth$))+Saddlecloth$
      styles$(f) = runstyle1$
      lmh$(f) = quirinstyle$
      firstimer(f) = firster
      surface(f) =  surfind
      surface1(f) =  surfind1
      surface2(f) =  surfind2
      lenindicator(f) = lenind
      lenindicator1(f) = lenind1
      lenindicator2(f) = lenind2
      postpos$(f) = post$
      firster$(f) = firster$

      holder(f,0) = f
      holder(f,1) = programnum
      holder(f,2) = daysaway
      holder(f,3) = class
      holder(f,4) = distspd
      holder(f,5) = earlypace
      holder(f,6) = latepace
      holder(f,7) = form
      holder(f,8) = pcr
      holder(f,9) = allweath
      holder(f,10) = turf
      holder(f,11) = muddy
      holder(f,12) = dirt
      holder(f,13) = fastnum
      holder(f,14) = trainer
      holder(f,15) = jockey
      holder(f,16) = mornlineodds
      holder(f,17) = 0 ' points total
      holder(f,18) = 0 ' fair odds
      holder(f,19) = bigfig2
      holder(f,20) = bigfig1
      holder(f,21) = bigfig
      holder(f,22) = rank
      holder(f,23) = works
      holder(f,27) = weight


          Classtest(f,1) = DMeps ' store class ratings into array as read from horse.dat file
          Classtest(f,2) = DMwinpct
          Classtest(f,3) = DMitmpct

      'for i = 1 to 3
      '    print Classtest(f,i),holder(f,3),holder(f,5)
      'next
      ' print

          If f = 0 then  'initialize Hi/Lo values with the first horse
              HIeps = Classtest(f,1):HIwinpct = Classtest(f,2):HIitmpct = Classtest(f,3)
              LOeps = Classtest(f,1):LOwinpct = Classtest(f,2):LOitmpct = Classtest(f,3)
              HIepace = holder(f,5):LOepace = holder(f,5)
              HIspd = holder(f,3):LOspd = holder(f,3)
          Else
          'now compare to get highest and lowest values
              If Classtest(f,1) > HIeps then HIeps = Classtest(f,1)
              If Classtest(f,2) > HIwinpct then HIwinpct = Classtest(f,2)
              If Classtest(f,3) > HIitmpct then HIitmpct = Classtest(f,3)
              If Classtest(f,1) < LOeps then LOeps = Classtest(f,1)
              If Classtest(f,2) < LOwinpct then LOwinpct = Classtest(f,2)
              If Classtest(f,3) < LOitmpct then LOitmpct = Classtest(f,3)
              If holder(f,5) > HIepace then HIepace = holder(f,5)
              If holder(f,3) > HIspd then HIspd = holder(f,3)
              If holder(f,5)  < LOepace then LOepace = holder(f,5)
              If holder(f,3)  < LOspd then LOspd = holder(f,3)
          end if

      'test$ = STR$ (Classtest(f,1)) + " " + STR$ (Classtest(f,2)) + " " + STR$ (Classtest(f,3))
      '
      'if f = 0 or f = 1 or f= 2 then
      '    Notice test$
      'end if

      'end if

      mount = mount + 1
      next f


          epsRange = HIeps - LOeps:winpctRange = HIwinpct - LOwinpct:itmpctRange = HIitmpct - LOitmpct
          '  if first time starters with no ITM finishes, then set ranges to 1 so no division by 0 errors
          if epsRange = 0 then epsRange = 1
          if winpctRange = 0 then winpctRange = 1
          if itmpctRange = 0 then itmpctRange = 1
          'print epsRange,winpctRange,itmpctRange:input a$
          for cntr = 0 to numb - 1
              If firstimer(cntr) = 0 then '  only run when not a firster
                  eps = 60 + 40*((Classtest(cntr,1) - LOeps) / epsRange)
                  winpct = 60 + 40*((Classtest(cntr,2) - LOwinpct) / winpctRange)
                  itmpct = 60 + 40*((Classtest(cntr,3) - LOitmpct) / itmpctRange)
                  DMclassScore = (.4 * eps) + (.3 * winpct) + (.3 * itmpct)
                  ' round the score if remainder > .5
                  if DMclassScore MOD 1 > .5 then
                      DMclassScore = INT (DMclassScore) + 1
                  Else
                      DMclassScore = INT (DMclassScore)
                  end if
              Else
                  if firstimer(cntr) = 1 then DMclassScore = 0
              end if
              holder(cntr,24) = DMclassScore
              'print holder(cntr,24)
          next

      '--------Modified pace/speed figs from WTS
          epaceRange = HIepace - LOepace:spdRange = HIspd - LOspd
          If epaceRange = 0 then epaceRange = 1
          If spdRange = 0 then spdRange = 1
          for cntr = 0 to numb - 1
              if firstimer(cntr) = 0 then
                  ep = 60 + 40*((holder(cntr,5) - LOepace) / epaceRange)
                  spd = 60 + 40*((holder(cntr,3) - LOspd) / spdRange)
                  if todaysdistance < 7.5 then
                      spdfig = INT ((.6 * ep) + (.4 * spd))
                     ' print "Todays distance is < 7.5"
                  Else
                      spdfig = INT ((.5 * ep) + (.5 * spd))
                      ' print "Todays distance is > 7.5"
                  end if
              Else
                  if firstimer(cntr) = 1 then spdfig = 0
              end if
              holder(cntr,25) = spdfig
          next
      'print:print todaysdistance:print
      '-------calculate modifed Mitchell power number
          for cntr = 0 to numb - 1
              if todaysdistance < 7.5 then
                  pwr = INT ((.6 * holder(cntr,25)) + (.4 * holder(cntr,24)))
                  holder(cntr,26) = pwr
              else
                  pwr = INT ((.5 * holder(cntr,25)) + (.5 * holder(cntr,24)))
                  holder(cntr,26) = pwr
              end if
          next

      'fastnum = (int(((fig + ccc1 + hy + avlp + avsp + ds) / 6)*10)) *.1

      'experimental fast number
          for cntr = 0 to numb - 1
              holder(cntr,13) = holder(cntr,13) + int((.15 * holder(cntr,24)))
          next


      sort holder(), numb-1,0,3
      holder(0,17) = Val (CL$)
      holder(1,17) = INT (.5 * Val (CL$))
      holder(2,17) = INT (.5 * Val (CL$))
      holder(3,17) = INT (.5 * Val (CL$))
      sort holder(), numb-1,0,4
      holder(0,17) = Val (DS$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (DS$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (DS$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (DS$)) + holder(3,17)
      sort holder(), numb-1,0,5
      holder(0,17) = Val (EP$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (EP$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (EP$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (EP$)) + holder(3,17)
      sort holder(), numb-1,0,6
      holder(0,17) = Val (LP$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (LP$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (LP$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (LP$)) + holder(3,17)
      sort holder(), numb-1,0,7
      holder(0,17) = Val (FM$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (FM$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (FM$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (FM$)) + holder(3,17)
      sort holder(), numb-1,0,8
      holder(0,17) = Val (PCR$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (PCR$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (PCR$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (PCR$)) + holder(3,17)
      sort holder(), numb-1,0,9
      holder(0,17) = Val (AW$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (AW$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (AW$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (AW$)) + holder(3,17)
      sort holder(), numb-1,0,10
      holder(0,17) = Val (TF$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (TF$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (TF$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (TF$)) + holder(3,17)
      sort holder(), numb-1,0,11
      holder(0,17) = Val (MY$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (MY$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (MY$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (MY$)) + holder(3,17)
      sort holder(), numb-1,0,12
      holder(0,17) = Val (DT$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (DT$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (DT$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (DT$)) + holder(3,17)
      sort holder(), numb-1,0,13
      holder(0,17) = Val (FAST$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (FAST$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (FAST$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (FAST$)) + holder(3,17)
      sort holder(), numb-1,0,14
      holder(0,17) = Val (TR$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (TR$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (TR$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (TR$)) + holder(3,17)
      sort holder(), numb-1,0,15
      holder(0,17) = Val (JK$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (JK$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (JK$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (JK$)) + holder(3,17)
      sort holder(), 0,numb-1,16
      holder(0,17) = Val (ML$) + holder(0,17)
      holder(1,17) = INT (.5 * Val (ML$)) + holder(1,17)
      holder(2,17) = INT (.5 * Val (ML$)) + holder(2,17)
      holder(3,17) = INT (.5 * Val (ML$)) + holder(3,17)

      sort holder(),0,numb-1,0
      for f = 0 to numb-1
      totpoints = totpoints + holder(f,17)
      next f
      for ff = 0 to numb-1
      if holder(ff,17) < 1 then
      holder(ff,18) = 0 '99
      else
      holder(ff,18) = (totpoints-holder(ff,17))/holder(ff,17)

      end if
      next ff


      for pts = 0 to numb-1
      srts(pts,0) =  pts
      srts(pts,1) = holder(pts,17)
      srts(pts,2) = holder(pts,18)
      next pts
      sort srts(),numb-1,0,1
      y = 210

      [cleanodds2]

      for cl = 0 to numb
      srts(cl,0) = 0  'changed the 2nd index # as they were all "0" before
      srts(cl,1) = 0
      srts(cl,2) = 0

      next cl
      totpoints = 0

       

          '-----Begin code for #main.race

          nomainwin
          WindowWidth = 1240
          WindowHeight = 900
          UpperLeftX=int((DisplayWidth-WindowWidth)/2)
          UpperLeftY=int((DisplayHeight-WindowHeight)/2)


          '-----Begin GUI objects code
          'If DisplayWidth < 1025 then
             ' button #mainrace.button1,"Close",[closedisplay], UL, 535, 646, 150,  25
          'Else
          '    button #mainrace.button1,"Close",[closedisplay], UL, 535, 712, 150,  25
          'End if

          '-----End GUI objects code

          open "F.A.S.T. HHX Ver 2.2" for graphics_nf_nsb as #mainrace2
          print #mainrace2, "down;fill white"
          print #mainrace2, "color black; backcolor white"
          print #mainrace2, "font ms_sans_serif 10"
          'print #mainrace2.button1, "!font rockwell_extra_bold 12"
          print #mainrace2,"Horizscrollbar Off" 'n 0 200"
          print #mainrace2,"Vertscrollbar Off" 'n 0 800"
          print #mainrace2, "trapclose [quit.mainrace]"

      ' --- adjust window if 1024 x 768 rez
      'If DisplayWidth < 1025 then
      '    hMain = HWND(#mainrace)
      '    hparent = GetParent (hMain)

      '    calldll #user32, "MoveWindow",_
      '    hparent as ulong, _       'window handle
      '    1 as long,_            'x location of window
      '    1 as long,_            'y location of window
      '    1024 as long,_           'desired width of window
      '    734 as long,_           'desired height of window
      '    1 as boolean,_          'repaint flag,0=false,1=true
      '    ret as long             'nonzero=success

      'End if


      y = 130

      for pt = 0 to numb-1
      srt(pt,0) =  pt
      srt(pt,1) = holder(pt,17)
      next pt
      sort srt(),numb-1,0,1 ' sort function

       

       

       

       

      print #mainrace2,"down;fill white"
      print #mainrace2,"color black;backcolor white"
      print #mainrace2, "font arial 12 bold"
      GETTRIM #race1, racenum
      print #mainrace2, "place 12 22"
      print #mainrace2, "\";Track$;"   ";racemonth;"/";racedate;"/";raceyr;"                                                                                         ";"Form Adjusted Speed Totals"
      print #mainrace2, "color black"
      print #mainrace2, "place 12 42"
      print #mainrace2, "\Race # ";racenum;"  ";posttime$;"  ";distance$;"  ";surf$;"  ";statebred$;RaceClassification$;"  ";hurdles$;"  ";"Purse ";"$";Purse;"  ";cond$;"  ";cond22$;"  ";cond33$;" ";text$
      print #mainrace2, "place 12 62"
      print #mainrace2, "\";wage$;wage2$
      'print #mainrace2, "place 440 84 "; y
      'print #mainrace2, "\(Double-click in any column with numbers to sort)";
      print #mainrace2, "color  black"
      print #mainrace2, "size 2"
      print #mainrace2, "line 01 68 1190 68"
      'print #mainrace2, "size 2"
      'print #mainrace2, "line 55 100  55 800"
      print #mainrace2, "place 8 106"
      print #mainrace2, "\Pr#";
      print #mainrace2, "place 44 106"
      print #mainrace2, "\Horse Name";
      print #mainrace2, "place 44 86"
      print #mainrace2, "font arial 12 bold" 'italic"
      print #mainrace2, "\Weights assigned =>";
      print #mainrace2, "font arial 10 bold" 'italic"
      print #mainrace2, "place 248 86"
      print #mainrace2, "\"+CL$;
      print #mainrace2, "place 284 86"
      print #mainrace2, "\"+DS$;
      print #mainrace2, "place 320 86"
      print #mainrace2, "\"+EP$;
      print #mainrace2, "place 392 86"
      print #mainrace2, "\"+LP$;
      print #mainrace2, "place 464 86"
      print #mainrace2, "\"+FM$;
      print #mainrace2, "place 500 86"
      print #mainrace2, "\"+PCR$;
      print #mainrace2, "place 538 86"
      print #mainrace2, "\"+AW$;
      print #mainrace2, "place 574 86"
      print #mainrace2, "\"+TF$;
      print #mainrace2, "place 608 86"
      print #mainrace2, "\"+MY$;
      print #mainrace2, "place 646 86"
      print #mainrace2, "\"+DT$;
      print #mainrace2, "place 682 86"
      print #mainrace2, "\"+FAST$;
      print #mainrace2, "place 716 86"
      print #mainrace2, "\"+TR$;
      print #mainrace2, "place 752 86"
      print #mainrace2, "\"+JK$;
      print #mainrace2, "place 1004 86"
      print #mainrace2, "\"+ML$;
      print #mainrace2, "color  black"
      print #mainrace2, "size 2"
      print #mainrace2, "line 01 112 1190 112"
      print #mainrace2, "color  black"
      'print #mainrace2, "size 2"
      'print #mainrace2, "line 220 100  220 800"

      '----------- These headings added to replace buttons for sort
      print #mainrace2, "font arial 10 bold" '"font rockwell_extra_bold 9 "
      'print #mainrace2, "color  blue"
      print #mainrace2, "place 212 106"
      print #mainrace2, "\LR";
      print #mainrace2, "place 248 106"
      print #mainrace2, "\CL";
      print #mainrace2, "place 284 106"
      print #mainrace2, "\DS";
      print #mainrace2, "place 320 106"
      print #mainrace2, "\EP";
      print #mainrace2, "place 356 106"
      print #mainrace2, "\RT";
      print #mainrace2, "place 392 106"
      print #mainrace2, "\LP";
      print #mainrace2, "place 428 106"
      print #mainrace2, "\RS";
      print #mainrace2, "place 464 106"
      print #mainrace2, "\FM";
      print #mainrace2, "place 500 106"
      print #mainrace2, "\PC";
      print #mainrace2, "place 536 106"
      print #mainrace2, "\AW";
      print #mainrace2, "place 574 106"
      print #mainrace2, "\TF";
      print #mainrace2, "place 608 106"
      print #mainrace2, "\MY";
      print #mainrace2, "place 646 106"
      print #mainrace2, "\DT";
      print #mainrace2, "place 673 106"
      print #mainrace2, "\FAST";
      print #mainrace2, "place 716 106"
      print #mainrace2, "\TR";
      print #mainrace2, "place 752 106"
      print #mainrace2, "\JK";
      print #mainrace2, "place 790 106"
      print #mainrace2, "\S3";
      print #mainrace2, "place 824 106"
      print #mainrace2, "\S2";
      print #mainrace2, "place 862 106"
      print #mainrace2, "\S1";
      print #mainrace2, "place 894 106"
      print #mainrace2, "\C-C";
      print #mainrace2, "place 930 106"
      print #mainrace2, "\P-S";
      print #mainrace2, "place 963 106"
      print #mainrace2, "\PWR";
      print #mainrace2, "place 1004 106"
      print #mainrace2, "\ML";
      print #mainrace2, "place 1038 86"
      print #mainrace2, "\FAIR";
      print #mainrace2, "place 1034 106"
      print #mainrace2, "\ODDS";
      print #mainrace2, "place 1076 86"
      print #mainrace2, "\TOT";
      print #mainrace2, "place 1078 106"
      print #mainrace2, "\PTS";

      print #mainrace2, "font arial 9 "
      for t = 0 to numb-1
      'if firstimer(srt(t,0)) = 1 then
      'print #mainrace2, "color  red"
      'else
      print #mainrace2, "color  black"
      'end if
      'if name$(srt(t,0)) = "" then goto [print2looped]
      print #mainrace2, "place 12  "; y
      print #mainrace2, "\"; saddle$(srt(t,0))
      x=42:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 45  "; y
      print #mainrace2, "\"; name$(srt(t,0))
      x=204:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 210 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),2)) ' days away
      x=240:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 246 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),3)) ' class
      x=276:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 282 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),4)) ' dist speed
      x=312:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 318 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),5)) ' early speed
      x=348:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 358 "; y
      print #mainrace2, "\"; styles$(srt(t,0))
      x=384:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 390 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),6)) ' late pace
      x=420:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 430 "; y
      print #mainrace2, "\"; lmh$(srt(t,0))
      x=456:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 462 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),7)) ' form
      x=492:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 498 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),8)) ' pcr
      x=528:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 534 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),9)) ' aw
      x=564:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 570 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),10)) ' turf
      x=600:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 606 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),11)) ' mud
      x=636:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 642 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),12)) ' dirt
      x=672:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "font arial 9 bold"
      print #mainrace2, "color  blue"
      print #mainrace2, "place 678 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),13)) ' fast
      print #mainrace2, "font arial 9"
      print #mainrace2, "color  black"
      x=708:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 714 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),14)) ' tnwpct
      x=744:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 750 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),15)) ' jkwpct
      x=780:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 786 "; y
      gosub [print2getcolor2]
      gosub [print2getdist2]
      print #mainrace2, "\"; using("###", holder(srt(t,0),19)) ' 3rsr
      print #mainrace2, "font arial 9"
      print #mainrace2, "color  black"
      x=816:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 822 "; y
      gosub [print2getcolor1]
      gosub [print2getdist1]
      print #mainrace2, "\"; using("###", holder(srt(t,0),20)) ' 2rsr
      print #mainrace2, "font arial 9"
      print #mainrace2, "color  black"
      x=852:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 858 "; y
      gosub [print2getcolor]
      gosub [print2getdist]
      print #mainrace2, "\"; using("###", holder(srt(t,0),21)) ' lrsr
      print #mainrace2, "font arial 9 "
      print #mainrace2, "color  black"
      x=888:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      'change display to eliminate WK and RK score;  replace with C-C and P-S
      print #mainrace2, "place 894 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),24)) ' c-c
      x=924:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 930 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),25)) ' p-s
      x=960:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 966 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),26)) ' pwr
      x=996:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 1004 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),16)) ' ml
      x=1032:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "place 1038 "; y
      print #mainrace2, "\"; using ("###.#", holder(srt(t,0),18)) ' fair odds
      x=1072:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "font arial 9 bold"
      print #mainrace2, "color  blue"
      print #mainrace2, "place 1078 "; y
      print #mainrace2, "\"; using("###", holder(srt(t,0),17)) ' point total
      print #mainrace2, "font arial 9"
      print #mainrace2, "color  black"
      x=1108:z=68
      '#main, "place ";x;" ";y;  line down
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";x;" ";z
      print #mainrace2, "font arial 9 bold"
      print #mainrace2, "color  red"
      print #mainrace2, "place 1114 "; y
      print #mainrace2, "\"; firster$(srt(t,0))
      print #mainrace2, "font arial 9 "
      print #mainrace2, "color  black"


      'y = y + 4:x=5:b=1230

      x=1:b=1190
      '#main, "place ";x;" ";y;
      print #mainrace2, "down"
      print #mainrace2, "line ";x;" ";y+8;" ";b;" ";y+8;


      '--------
      lasty = y ' the last y position for MouseY double-click test

      y = y + 25
      '[print2looped]
      next t

      Dim mline(25),fodds(25),tpoints(25)
      for a = 0 to numb-1
      'if name$(srt(a,0)) = "" then goto [parlooped1]
      'print #mainrace, "place 25 "; y+20
      'print #mainrace, "\"; saddle$(srts(a,0))
      'print #mainrace, "place 60  "; y+20
      'print #mainrace, "\"; name$(srts(a,0))
      'print #mainrace, "place 233 "; y+20
      'print #mainrace, "\"; holder(srts(a,0),16)
      mline(a)=holder(srts(a,0),16)'for use in csv
      'print #mainrace, "place 273 "; y+20
      'print #mainrace, "\";  int((holder(srts(a,0),18)-1)*10)*.1
      fodds(a) = int((holder(srts(a,0),18)-1)*10)*.1 'for use in csv
      'print #mainrace, "place 328 "; y+20
      'print #mainrace, "\";  holder(srts(a,0),17)
      tpoints(a) = holder(srts(a,0),17)'for use in csv
      y = y+25
      '[parlooped1]
      next a

      Dim Top4$(25)
      for count = 0 to 3
          Top4$(count) = saddle$(srts(count,0))+","+name$(srts(count,0))+","+STR$(mline(count))+","+STR$(fodds(count))+","+STR$(tpoints(count))
      next

      print #mainrace2, "flush"

      '***  CSV code
      If didcsv = 0 then
          Dim Ratings$(20)
          Dim Copied(numb-1,26)
          Dim Converted$(numb-1,26)
          crlf$ = CHR$(13) + CHR$(10)
          RaceDate$= Str$(racemonth) + "/" + STR$(racedate) + "/" + STR$(raceyr)+ ","  + "Race# " + str$(racenum)
          commas24$ =  "," + "," + "," + "," + ","+ "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + "," + ","
          RaceInfo1$=Track$ + " " + RaceDate$+commas24$+","+Track$ + " " + RaceDate$+crlf$
          RaceInfo2$=RaceClassification$ + "," + cond$ + " " + cond22$ + " "+ str$(todaysdistance) +"F " + surf$ + "," +commas24$+_
          RaceClassification$ + "," + cond$ + " " + cond22$ + " "+ str$(todaysdistance) +"F " + surf$ +crlf$
          Heading$ = "Program #"+","+"Horse Name"+","+"LR"+"," +"CL"+","+"DS"+","+"EP" + ","+"RT"+","+"LP"+","+"RS"+","+"FM"+","+"PC"+","+_
          "AW"+","+"TF"+","+"MY"+","+"DT"+","+"FAST"+","+"TR"+","+"JK"+","+"ML"+","+"S3"+","+"S2"+","+"S1"+","+"C-C"+","+"P-S"+","+"PWR"+_
          ","+","+"Program #"+","+"Horse"+","+"M/L"+","+"Fair Odds"+","+"Points"+crlf$
          for count = 0 to numb-1
              'Can't use STR$ function on array with srt so have to copy to another array and then use STR$
              For count2 = 2 to 26
                  If (count2 =17) or (count2 =18) or (count2 =22) or (count2 =23) then 'skip missing values
                      'print "skipped count2 ";count2
                  else
                      Copied(count,count2) = holder(srt(count,0),count2)
                      Converted$(count,count2)=STR$(Copied(count,count2))
                  end if
              next count2
          next count
          Dim NewCSV$(20),NewRating$(20)
          For count = 0 to numb - 1
              NewRating$(count)=""
              NewCSV$(count) = Track$ + "," + Date$ + "," + STR$(racenum)+ "," + distyards$ + ","+ Surface$ + "," + RaceType$+"," +_
              RaceClassification$ + "," + Purse$ + "," +saddle$(srt(count,0))+","+ name$(srt(count,0))+","+ STR$(holder(count,27)) +"," + postpos$(count)+","
              'print NewCSV$(count)
              For count2 = 2 to 26
                  If (count2 =17) or (count2 =18) or (count2 =22) or (count2 =23) then 'skip missing values
                      'print "skipped count2 ";count2
                  else
                      if count2 <> 26 then
                          If count2 = 6 then Ratings$(count) = Ratings$(count) +  styles$(srt(count,0))+","
                          If count2 = 7 then Ratings$(count) = Ratings$(count) + lmh$(srt(count,0))+","
                          Ratings$(count) = Ratings$(count) + Converted$(count,count2) + ","
                          NewRating$(count) =  Ratings$(count)

                      Else
                          NewRating$(count) = Ratings$(count) + Converted$(count,count2)
                          if count = 0 or count = 1 or count = 2 or count = 3 then 'add Top 4 output to the rows of the 1st 4 horses
                              Ratings$(count) = Ratings$(count) + Converted$(count,count2) +","+","+Top4$(count)
                          else'don't add comma after last item
                              Ratings$(count) = Ratings$(count) + Converted$(count,count2)
                          end if
                      end if
                  end if
              next
              roundedValue = val(using("###.#", holder(count,18))) - 1
              If roundedValue >90 then roundedValue = 99
              Fodds$ = STR$(roundedValue)
              NewCSV$(count)=NewCSV$(count) + NewRating$(count) + "," + STR$(holder(count,17))+ "," + Fodds$ + crlf$
              Ratings$(count)=saddle$(srt(count,0))+","+ name$(srt(count,0))+","+Ratings$(count)+crlf$
              'print NewCSV$(count)
          next


      RaceCSV$=RaceInfo1$+RaceInfo2$+Heading$
      For count = 0 to numb-1
          RaceCSV$= RaceCSV$+Ratings$(count)
      next

      For count = 0 to numb-1
          NewTrackCSV$= NewTrackCSV$+NewCSV$(count)
      next

      'print RaceCSV$
      TrackCSV$=TrackCSV$+RaceCSV$
      didcsv=1 ' flag so that if summary screen sorted do not repeat the csv save
      end if

       


      print #mainrace2, "print 1180"

      'if R > 17 then print #mainrace2, "print 1140"
      'if R < 18 then print #mainrace2, "print xga"
      print #mainrace2, "Discard"

          close #mainrace2


      if racenum = 1 then goto [printrace2]
      if racenum = 2 then goto [printrace3]
      if racenum = 3 then goto [printrace4]
      if racenum = 4 then goto [printrace5]
      if racenum = 5 then goto [printrace6]
      if racenum = 6 then goto [printrace7]
      if racenum = 7 then goto [printrace8]
      if racenum = 8 then goto [printrace9]
      if racenum = 9 then goto [printrace10]
      if racenum = 10 then goto [printrace11]
      if racenum = 11 then goto [printrace12]
      if racenum = 12 then goto [printrace13]
      if racenum = 13 then goto [printrace14]


      goto [main.inputLoop]

       

      [print2getcolor2]

      SELECT CASE surface2(srt(t,0))

       CASE 1

       print #mainrace2, "color  40 160 37"

       CASE 2

      print #mainrace2, "color  147 105 87"

       CASE else
      print #mainrace2, "color  Black"
      end select

      return

      '***********
      [print2getcolor1]

      SELECT CASE surface1(srt(t,0))

       CASE 1

       print #mainrace2, "color  40 160 37"

       CASE 2

      print #mainrace2, "color  147 105 87"

      CASE else
      print #mainrace2, "color  Black"

      end select

      return

      '***********
      [print2getcolor]

      SELECT CASE surface(srt(t,0))

       CASE 1

       print #mainrace2, "color  40 160 37"

       CASE 2

      print #mainrace2, "color  147 105 87"

      CASE else
      print #mainrace2, "color  Black"

      end select

      return

      '**********************
      [print2getdist]

      SELECT CASE lenindicator(srt(t,0))

      case 1

      print #mainrace2, "font arial 9 "

      CASE else

      print #mainrace2, "font arial 11 italic bold"

      end select

      return

      [print2getdist2]

      SELECT CASE lenindicator2(srt(t,0))

      case 1

      print #mainrace2, "font arial 9 "

      CASE else

      print #mainrace2, "font arial 11 italic bold"

      end select

      return


      [print2getdist1]

      SELECT CASE lenindicator1(srt(t,0))

      case 1

      print #mainrace2, "font arial 9 "

      CASE else

      print #mainrace2, "font arial 11 italic bold"

      end select

      return

       

       

       

       

      [SelectPrinter]
          WinVersion=WinVersion()
          if WinVersion>=5 then gosub [Find2000xpvistaprinters]'find installed printers
          if WinVersion<=4 then notice "Incompatible OS"+chr$(13)+_
                      "This function will only work on Windows 2000,"+chr$(13)+_
                      "Windows XP or Windows Vista":wait
          TEMPSelectedPrinter$=SelectedPrinter$

          ScrnScl=GetScaleFactor()

          WindowWidth=int(440/ScrnScl):WindowHeight=int(270/ScrnScl)
          UpperLeftX=int(((DisplayWidth-WindowWidth)/2)/ScrnScl)
          UpperLeftY=int(((DisplayHeight-WindowHeight)/2)/ScrnScl)
          BackgroundColor$ = "buttonface"

          groupbox #pselect.one, "Printer",     int(13/ScrnScl),  int(6/ScrnScl),   int(410/ScrnScl),  int(80/ScrnScl)
          groupbox #pselect.two, "Print range", int(13/ScrnScl),  int(92/ScrnScl), int(217/ScrnScl),  int(105/ScrnScl)
          groupbox #pselect.thr, "Copies",      int(240/ScrnScl), int(92/ScrnScl), int(183/ScrnScl),  int(105/ScrnScl)

          statictext #pselect.1, "Name:",       int(25/ScrnScl),  int(33/ScrnScl),  int(55/ScrnScl),   int(26/ScrnScl)
          statictext #pselect.6, "from:",       int(89/ScrnScl),  int(145/ScrnScl),  int(26/ScrnScl),  int(23/ScrnScl)
          statictext #pselect.7, "to:",         int(165/ScrnScl),  int(145/ScrnScl), int(12/ScrnScl),  int(23/ScrnScl)

          statictext #pselect.8, "Number of copies:",   int(251/ScrnScl),  int(115/ScrnScl), int(112/ScrnScl), int(23/ScrnScl)

          combobox #pselect.list1, prnt$(),[pSelected1], int(80/ScrnScl), int(29/ScrnScl), int(227/ScrnScl),  100

          button #pselect.default,"OK",[pSelected2], UL,           int(270/ScrnScl), int(207/ScrnScl),  int(75/ScrnScl),  int(24/ScrnScl)
          button #pselect.Cancel,"Cancel",[quit.pselect], UL,      int(351/ScrnScl), int(207/ScrnScl),  int(75/ScrnScl),  int(24/ScrnScl)
          button #pselect.Cancel,"Properties...",[pProperties], UL,int(319/ScrnScl), int(26/ScrnScl),   int(92/ScrnScl),  int(24/ScrnScl)

          checkbox #pselect.checkbox1, "Print to file", [pyes], [pno],int(319/ScrnScl), int(57/ScrnScl),  int(80/ScrnScl),  int(25/ScrnScl)

          radiobutton #pselect.one, "All", [pyes], [pno], int(25/ScrnScl), int(115/ScrnScl), int(60/ScrnScl), int(20/ScrnScl)
          radiobutton #pselect.two, "Pages", [pyes], [pno], int(25/ScrnScl), int(140/ScrnScl), int(60/ScrnScl), int(20/ScrnScl)
          radiobutton #pselect.thr, "Selection", [pyes], [pno], int(25/ScrnScl), int(165/ScrnScl), int(85/ScrnScl), int(20/ScrnScl)
          textbox #pselect.textbox1, int(116/ScrnScl), int(140/ScrnScl),int(38/ScrnScl),int(20/ScrnScl)
          textbox #pselect.textbox2, int(180/ScrnScl), int(140/ScrnScl),int(38/ScrnScl),int(20/ScrnScl)

          textbox #pselect.textbox3, int(363/ScrnScl), int(110/ScrnScl),int(48/ScrnScl),int(20/ScrnScl)

          stylebits #pselect.g1, 0, _WS_BORDER, 0, 0
          stylebits #pselect.g2, 0, _WS_BORDER, 0, 0
          stylebits #pselect.g3, 0, _WS_BORDER, 0, 0
          stylebits #pselect.g4, 0, _WS_BORDER, 0, 0
          stylebits #pselect.g5, 0, _WS_BORDER, 0, 0
          stylebits #pselect.g6, 0, _WS_BORDER, 0, 0
          graphicbox #pselect.g4, int(252/ScrnScl),int(155/ScrnScl) , int(20/ScrnScl), int(26/ScrnScl)
          graphicbox #pselect.g5, int(289/ScrnScl),int(155/ScrnScl) , int(20/ScrnScl), int(26/ScrnScl)
          graphicbox #pselect.g6, int(326/ScrnScl),int(155/ScrnScl) , int(20/ScrnScl), int(26/ScrnScl)
          graphicbox #pselect.g1, int(264/ScrnScl),int(148/ScrnScl) , int(20/ScrnScl), int(26/ScrnScl)
          graphicbox #pselect.g2, int(302/ScrnScl),int(148/ScrnScl) , int(20/ScrnScl), int(26/ScrnScl)
          graphicbox #pselect.g3, int(338/ScrnScl),int(148/ScrnScl) , int(20/ScrnScl), int(26/ScrnScl)

          open "Select Printer" for dialog_modal as #pselect
          #pselect "trapclose [quit.pselect]"
          #pselect.list1 "select ";TEMPSelectedPrinter$

          'create spinner control:http://libertybasic.conforums.com/index.cgi?board=LB3&action=display&num=1217524188
          UpperLimit = 200
          LowerLimit = 1
          CurrentPosition = 1
          hWnd = hWnd(#pselect)
          hText = hWnd(#pselect.textbox3)
          UDS.ARROWKEYS = hexdec("20")
          UDS.WRAP = hexdec("1")
          UDS.SETBUDDYINT = hexdec("2")
          UDS.ALIGNRIGHT = hexdec("4")
          dwStyle = _WS_CHILD or _WS_BORDER or _WS_VISIBLE or UDS.ARROWKEYS or UDS.WRAP or UDS.SETBUDDYINT or UDS.ALIGNRIGHT
          hSpinner = CreateSpinner(hWnd, dwStyle, hText, UpperLimit, LowerLimit, CurrentPosition)

          #pselect.checkbox1 "disable"
          #pselect.two "disable"
          #pselect.6 "!disable"
          #pselect.7 "!disable"
          #pselect.textbox1 "0"
          #pselect.textbox2 "0"
          #pselect.textbox1 "!disable"
          #pselect.textbox2 "!disable"
          #pselect.one "set"
          #pselect.default "!setfocus"

          for x=1 to NumberOfPrinters
            if prnt$(x)=DefaultPrinterName$ then #pselect.list1, "selectindex ";x
          next x

          for x=1 to 6
            c=c+1:var$ = "#pselect.g";x
            #var$, "font Times_New_Roman 7"
            #var$, "down;color darkgray"
            #var$, "line 0 0 30 0"
            #var$, "line 0 0 0 25"
            #var$, "color black"
            #var$, "line 19 0 19 25"
            #var$, "line 0 24 20 24"
            #var$, "place 10 21"
            #var$, "\";c
            #var$, "flush"
            if c=3 then c=0
          next x

          wait

      [pProperties]
          notice "This feature is not available."
          wait

      [pyes]
          wait

      [pno]
          wait

      [quit.pselect]
          SelectedPrinter$=TEMPSelectedPrinter$
          calldll #user32, "DestroyWindow",_
            hSpinner as ulong, ret as long
          close #pselect
          end

      [pSelected1]
          #pselect.list1 "selection? sel$"
          SelectedPrinter$=sel$
          wait

      [pSelected2]
          #pselect.list1 "selection? sel$"
          SelectedPrinter$=sel$
          if sel$="" then notice "Please select a printer"
          calldll #user32, "DestroyWindow",_
            hSpinner as ulong, ret as long
          print "Selected printer...";SelectedPrinter$
          #pselect.textbox3 "!contents? copies"
          print "Number of copies...";copies
          close #pselect
          end

      [setdefaultprinter]
          open "winspool.drv" for dll as #winspool
          calldll #winspool, "SetDefaultPrinterA",_
            Printer$ as ptr,_
            SetDefaultPrinter as long
          close #winspool
          if SetDefaultPrinter=0 then call DisplayError
          return

      [Find2000xpvistaprinters]
          'find printers
          PRINTER.ENUM.LOCAL = hexdec("2")
          PRINTER.ENUM.CONNECTIONS = hexdec("4")
          nLocalPrinters = EnumPrinters(PrinterInfo$, PRINTER.ENUM.LOCAL)
          LocalPrintersInfo$ = PrinterInfo$
          PrinterInfo$ = ""
          nNetworkPrinters = EnumPrinters(PrinterInfo$, PRINTER.ENUM.CONNECTIONS)
          NetworkPrintersInfo$ = PrinterInfo$
          PrinterInfo$ = ""
          NumberOfPrinters = nLocalPrinters + nNetworkPrinters
          PrinterInfo$ = LocalPrintersInfo$;";";NetworkPrintersInfo$
          dim prnt$(NumberOfPrinters)
          if NumberOfPrinters then 'remove faxes from list
            prnt=0
            for x1=1 to NumberOfPrinters'remove "faxes", "Quicken pdf creator" and "Intuit pdf creator" from list
              if instr(lower$(word$(PrinterInfo$,x1,";")),"fax")=0 _
                  and instr(lower$(word$(PrinterInfo$,x1,";")),"quick")=0 _
                  and instr(lower$(word$(PrinterInfo$,x1,";")),"intuit")=0 _
                  then prnt=prnt+1:prnt$(prnt)=word$(PrinterInfo$,x1,";")
            next x1
          end if
          return

      function EnumPrinters(byref PrinterInfo$, pLocale)
          'returns the number of printers found
          'fills the submitted variable with the printer names
          'separated by semicolons (;)
          open "winspool.drv" for dll as #winspool
          struct pcbNeeded, value as ulong
          struct pcReturned, value as ulong
          struct PrinterInfo4,_
            pPrinterName$ as ptr,_
            pServerName$ as ptr,_
            Attributes as ulong
          PrinterInfo4Len = len(PrinterInfo4.struct)
          nFlags = pLocale
          Level = 4
          cbBuf = PrinterInfo4Len
          uFlags = _LMEM_MOVEABLE or _LMEM_ZEROINIT
          calldll #kernel32, "LocalAlloc", _
            uFlags as ulong, _
            cbBuf as ulong, _
            hMem as ulong
          calldll #kernel32, "LocalLock", _
            hMem as ulong, _
            pBuffer as ulong

      [retryEnumPrinters]
          calldll #winspool, "EnumPrintersA",_
            nFlags as ulong,_
            PrinterName as ulong,_
            Level as ulong,_
            pBuffer as ulong,_
            cbBuf as ulong,_
            pcbNeeded as struct,_
            pcReturned as struct,_
            result as long
          if result = 0 then
            if GetLastError() = 122 then
              cbBuf = pcbNeeded.value.struct
              hOldMem = hMem
              calldll #kernel32, "LocalReAlloc", _
       

      (Message over 64 KB, truncated)

    Your message has been successfully submitted and would be delivered to recipients shortly.