forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Get Windows Printer List

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
chucks0
Newbie


Joined: 08 Jun 2002
Posts: 23

PostPosted: Sat Jun 08, 2002 5:18 pm    Post subject: Get Windows Printer List Reply with quote

I am working on a script to help users install network printers. I want to be able to list the currently installed Windows printers. Does anyone know of a way to get this from within VDS?



Charles
Back to top
View user's profile Send private message
DanTheMan
Contributor
Contributor


Joined: 15 Mar 2002
Posts: 56
Location: Sweden

PostPosted: Sun Jun 09, 2002 8:42 am    Post subject: Reply with quote

Hi Charles,
you have to use the registry values to get this info. But you can pick those
parts from a small label printing program I wrote ...Very Happy

Code:
rem Print Barcode discount labels
  rem Version 1.00
  OPTION FIELDSEP, ","
  directory change,@path(%0)
  external vdsbar.dll
  external vdsimage.dll
  if @greater(@sysinfo(winver),4.9)
    %%NT = 1
  end      
  DIALOG CREATE,Label Printing,-1,0,355,212
REM *** Modified by Dialog Designer on 2002-06-09 - 10:29 ***
  DIALOG ADD,STYLE,STYLE1,,12,B,BACKGROUND,FOREGROUND
  DIALOG ADD,TEXT,TEXT1,0,100,,,Printing Discount Labels,STYLE1
  DIALOG ADD,EDIT,EDIT1,22,80,20,16,50,,EXIT,WRAP
  DIALOG ADD,TEXT,TEXT2,24,24,,,Discount %
  DIALOG ADD,TEXT,TEXT3,72,24,,,Printer:
  DIALOG ADD,TEXT,FRITEXT,112,24,,,Free Text:
  DIALOG ADD,EDIT,EDIT2,104,80,272,24
  DIALOG ADD,BUTTON,SKRIVUT,160,80,64,24,Print
  DIALOG ADD,BUTTON,SLUTA,160,192,64,24,Exit
  DIALOG ADD,COMBO,PRINTERSEL,72,80,176,21,,,CLICK,LIST
  DIALOG ADD,STATUS,STATUS,Total printed: 0
  DIALOG ADD,CHECK,CHECK1,72,272,56,16,Default
  DIALOG Disable,CHECK1
  DIALOG SHOW
  %%Counter = 0
  IF %%NT
      rem NT/2000
    rem Default Printer (NT/2000)
    %%DEFPRT = @REGREAD(CURUSER,software\Microsoft\Windows NT\CurrentVersion\Windows,Device)
    Parse "%N",%%DEFPRT
    %%DEFPRT = %N
     LIST REGVALS,PRINTERSEL,CURUSER,software\Microsoft\Windows NT\CurrentVersion\PrinterPorts
  else
     rem Default Printer (w9x)
    %%DEFPRT = @REGREAD(LOCAL,Config\0001\System\CurrentControlSet\Control\Print\Printers,default)
    Parse "%N",%%DEFPRT
    %%DEFPRT = %N
      LIST REGKEYS,PRINTERSEL,LOCAL,System\CurrentControlSet\control\Print\Printers\
  end
  LIST SEEK,PRINTERSEL,0
  %%PRINTER = @ITEM(PRINTERSEL)
  IF @Not(@Equal(%%PRINTER,%%DEFPRT))
     Repeat
        %%SLASK = @NEXT(PRINTERSEL)
      %%PRINTER = @dlgtext(PRINTERSEL)
     Until @EQUAL(%%PRINTER,%%DEFPRT)       
  end   
  DIALOG SET,CHECK1,1
:evloop
  wait event
  goto @event()
 
:EDIT1EXIT 
  IF @NOT(@NUMERIC(@dlgtext(edit1)))
      warn Discount % Not Legal.
     DIALOG FOCUS,EDIT1
  END
  goto evloop
:PrinterselCLICK
%%PRINTER = @dlgtext(PRINTERSEL)
IF @Equal(%%PRINTER,%%DEFPRT)
   DIALOG SET,CHECK1,1
else
   DIALOG SET,CHECK1,
end     
goto evloop

:SkrivutBUTTON   
  %%Code = 500K
  %%codetxt  = 50 %
  %%font  = Arial
  %%size  = 8
  %%attr  =
  %%color = black
  rem barcode Savecode,39,code.bmp,%%code,50,4,black,white
  barcode Savecode,39,code.bmp,@dlgtext(EDIT1)0K,50,4,black,white
  image open,code.bmp
  %%imagecenter = @div(@image(width),2)
  %%fontcenter  = @div(@image(textwidth,%%code,%%font,%%size,%%attr),2)
  %%center      = @diff(%%imagecenter,%%fontcenter)
  rem image text,55,%%center,%%codetxt,%%font,%%size,%%attr,%%color
  image text,55,%%center,@dlgtext(EDIT1) %,%%font,%%size,B,%%color
  %%FriText = @dlgtext(EDIT2)"                                        "
  image text,0,0,%%FriText,%%font,%%size,%%attr,%%color
  image height,@sum(@image(height),5)
  image save,code.bmp
  rem shell print,code.bmp,%%PRINTER,,wait
  %R = code.bmp %%PRINTER
  %R = @STRINS(%R,10,@chr(34))
  %R = %R@chr(34)
  run mspaint.exe /pt %R
  rem shell print,"c:\winnt\web\wallpaper\flugfiske.jpg",,,wait
  %%COUNTER = @SUCC(%%COUNTER)
  DIALOG SET,STATUS,Antal utskrivna: %%COUNTER
  goto evloop
:SlutaBUTTON
:CLOSE
  exit



Have fun!

/Dan
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group