Products | About Us

FIX : print from multiple magasin to multiple tray

Hi,

With a lot of hard work, I finaaly found a psstrough to print one document from different paper tray to different output tray.

This is not a 'recommended one', but could be very usefull for those who manage small print queue. Here are the steps :

0 - Create a printer for each combination of input/output tray you will have to deal with : configure the default option for each one to use the trays selected.

1 - Generate from the document a .PDF file

2 - Store this file in a 'queue' folder

3 - Through a VBScript running periodically, print those PDF files.



Here are a sample that print and manage the pdf file.


""""""""""""""""""""""""""""""
Dim oShell, objFSO, zTarget, objTxtFile, zDocName, objPrinter

Set objFSO = CreateObject("Scripting.FileSystemObject")
set WshShell = CreateObject("WScript.Shell")
Set objPrinter = CreateObject("WScript.Network")

zTarget = "d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\_ListToPrint.txt"

If not objFSO.FileExists (zTarget) Then
WScript.Quit
End If

Set objTxtFile = objFSO.OpenTextFile(zTarget,1, True)

Do Until objTxtFile.AtEndOfLine
zDocline = objTxtFile.ReadLine
' - Sélection d'un scenarii d'impression
Select Case Left(zDocline,4)
Case "_98_":
' - Blanc bac haut
'WScript.Sleep 5000
'objPrinter.SetDefaultPrinter "MTGIMP16 - Bac 1 Sortie Bas"
'WScript.Sleep 2000
'wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
'wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
'wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
' - En-tête bac haut
'WScript.Sleep 5000
'objPrinter.SetDefaultPrinter "MTGIMP16 - Bac 2 Sortie Bas"
'WScript.Sleep 2000
'wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
Case "_99_":
' - Blanc bac haut
WScript.Sleep 2000
objPrinter.SetDefaultPrinter "MTGIMP16 - Bac 1 Sortie Haut"
WScript.Sleep 2000
wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
' - Pré-Imprimé bac haut
WScript.Sleep 5000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'Acrobat.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
objPrinter.SetDefaultPrinter "MTGIMP16 - Bac 3 Sortie Haut"
WScript.Sleep 2000
wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
wscript.sleep 5000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'acrobat.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
wscript.sleep 2000
wshShell.run "wscript.exe d:\Batch_virtualPrinter\print.vbs d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline,,1
wscript.sleep 5000
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcessList = objWMIService.ExecQuery _
("SELECT * FROM Win32_Process WHERE Name = 'acrobat.exe'")
For Each objProcess in colProcessList
objProcess.Terminate()
Next
wscript.sleep 2000
End Select
' - Déplacement du fichier imprimé dans le dossier des impressions terminées.
WScript.Sleep 2000
objFSO.MoveFile "d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\" & zDocline, "d:\Batch_virtualPrinter\MTGIMP16_SpoolFolder\Printed\"
Loop

objTxtFile.Close

wscript.sleep 5000

WshShell.Run "D:\Batch_VirtualPrinter\Scheduled_DeletePrn.bat"

WScript.Quit
""""""""""""""""""""""""""

Not very smart, but however it works pretty well. Have a regard to 'sleep time', they will avoid any lost of printing.

To conclude, remeber that Print Migrator works through MS-Dos Print command (or is similar to...), this is why you are not able to select the input tray...

LVeirman
30th Jun 2008

This thread is closed to new posts.

Feed