WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Printer Controller

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

pPaperBins Problem

 Keywords: pPaperBins set default paper bin 

Question:

The PPaperBins command in the printer Extender is great but I need a user friendly way of selecting and setting a paper bin for our Xerox document centre 332ST.

The pGetPrtAttrib and pSetPrtAttrib do not appear to return anything useful (DefaultSource is always 260 irrespective of actual settings). pPaperBins returns the list I want, now all I want to do is set one! (an alternative would be to select the media type but that is even less obvious)

Answer:

Give this code a try:
AddExtender("WWPRT34i.DLL")
ver = pVersionInfo(0)
Message("Extender version", ver)
DefaultSource = pGetPrtAttrib("DefaultSource",2)
Message("Original Printer Bin", DefaultSource)
AddExtender("WWPRT34i.DLL")

bins = pPaperBins("", 1)
choice = AskitemList("Paper bins", bins, @TAB,@UNSORTED,@SINGLE)
binnum = ItemExtract(1,choice,"|")
ErrorMode(@Off)
ret = pSetPrtAttrib("DefaultSource", binnum,2)
ErrorMode(@cancel) 
if ret == 0
	 Message("", pGetErrorMsg()) ;'Access Denied' error
Endif 

;Check if default source is same as orignial...
DefaultSource = pGetPrtAttrib("DefaultSource",2)
Message("New Printer Bin", DefaultSource)

User Reply:

Thanks to all, red face this end!! I was using mode 1(Global) instead of 2 (Per-User) in pGetPrtAttrib. I attach a wbt to select bin from a user friendly list .
; PrtBinSel.WBT
; Routine to illustrate selection of bin from the user friendly list
; BinNum is the Bin ID
; BinNo is the position in the list(s) representing the bin
; 
AddExtender("WWPRT34i.DLL")
DefPrinter=pGetDefPrtInf(1)
BinNames = pPaperBins("", 0)
BinIdAllList = pPaperBins("", 1)
DefaultSource = pGetPrtAttrib("DefaultSource",2)

BinCount=ItemCount(BinNames,@tab)

for BinNo = 1 to  BinCount
	BinIdAll=ItemExtract(BinNo,BinIdAllList,@TAB)	
	binnum = ItemExtract(1,BinIdAll,"|")	
	if BinNo==1
		BinNumList=BinNum
	else
		BinNumList=strcat(BinNumlist,@tab,BinNum)
	endif
endfor
	

DefaultBinNo=ItemLocate(DefaultSource,BinNumList,@TAB)
DefaultBinName=ItemExtract(DefaultBinNo,BinNames,@TAB)
Message("Original Printer Bin no/Name ", "No=%DefaultSource% Name=%DefaultBinName%")

choice = AskitemList("Choose Paper bin for printer %DefPrinter%", binNames, @TAB,@UNSORTED,@SINGLE)

NowBinNo=itemlocate(Choice,binnames,@TAB)
NowBinNum=ItemExtract(NowBinNo,BinNumList,@tab)

ErrorMode(@Off)
ret = pSetPrtAttrib("DefaultSource", NowBinNum,2)
ErrorMode(@cancel) 
if ret == 0
	 Message("", pGetErrorMsg()) ;'Access Denied' error
Endif 

;Check if default source is same as orignial...
DefaultSource = pGetPrtAttrib("DefaultSource",2)
DefaultBinNo=ItemLocate(DefaultSource,BinNumList,@TAB)
DefaultBinName=ItemExtract(DefaultBinNo,BinNames,@TAB)


Message("New Printer Bin for %DefPrinter%","%DefaultSource% = %DefaultBinName%")

Article ID:   W15855
File Created: 2004:03:30:15:41:10
Last Updated: 2004:03:30:15:41:10