Imprimer une page html dans un .vbs

Canibool Messages postés 4 Date d'inscription mardi 17 octobre 2006 Statut Membre Dernière intervention 31 août 2007 - 30 août 2007 à 12:01
Canibool Messages postés 4 Date d'inscription mardi 17 octobre 2006 Statut Membre Dernière intervention 31 août 2007 - 30 août 2007 à 17:47
bonjour,

je cherche un moyen d'imprimer une page html dans un .vbs.

le contexte est le suivant: j'ai programme écrit dans un autre langage qui génère des bons de commande en html. ce programme appelle un script .vbs qui se charge d'imprimer cette page.

le script ne fait pas seulement qu'imprimer (même si c'est là qu'est mon problème). il configure un fax en imprimante par défaut, et des bidouilles de config du fax... ah oui parcequ'en c'est pas vraiment une impression, c'est un envoi de fax... mais il faut imprimer le document sur le fax pour qu'il soit envoyé.

j'avais essayé de faire ça avec un .pdf au lieu du html. c'est possible mais pour ça il faut acrobat payant (pour utiliser acroexch, une dll).

donc j'ai toujours pas de solution avec html car je n'ai pas trouvé de dll à invoquer pour imprimer (IE ou mozilla), ni de fonction PRINT à utiliser par un objet quelconque.

alors si quelqu'un à une astuce je suis preneur.

je vous montre le script pour faciliter la tâche:

Dim strComputer
Dim strDefPrinter
Dim net
Dim iTemp
Dim sPrinter
Dim FaxNum
Dim hnd
Dim ret
Dim WshShell
dim oldDefPrinter
Dim DefPrinter
Dim oFso
Dim oFile

FaxNum = "6726"
strComputer = "."
strDefPrinter = ""

Set net = CreateObject("WScript.Network")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
    if instr(1,objPrinter.Name,"RICOH")<>0 then
        strDefPrinter = objPrinter.Name
    end if
Next

net.SetDefaultPrinter strDefPrinter

Set WshShell = WScript.CreateObject ("WScript.Shell")
hnd = WshShell.Run("%windir%\system32\RUNDLL32.EXE Ifxapi32.dll,IfxOpen " & strDefPrinter,1,true)
Wscript.Echo hnd
ret = WshShell.Run("%windir%\system32\RUNDLL32.EXE Ifxapi32.dll,IfxSender " & hnd & " 1 " & FaxNum,1,true)
Wscript.Echo ret
ret = WshShell.Run("%windir%\system32\RUNDLL32.EXE Ifxapi32.dll,IfxTTI " & hnd & " " & IFX_TTI_ON,1,true)
Wscript.Echo ret
ret = WshShell.Run("%windir%\system32\RUNDLL32.EXE Ifxapi32.dll,IfxLock " & hnd,1,true)
Wscript.Echo ret

Set oFso = CreateObject("Scripting.FileSystemObject")
Set oFile = oFso.GetFile("D:\opt\oracle\cde.htm")

--là il faudrait imprimer

ret = WshShell.Run("%windir%\system32\RUNDLL32.EXE Ifxapi32.dll,IfxUnlock " & hnd,1,true)
Wscript.Echo ret
ret = WshShell.Run("%windir%\system32\RUNDLL32.EXE Ifxapi32.dll,IfxClose " & hnd,1,true)
Wscript.Echo ret

merci d'avance

1 réponse

Canibool Messages postés 4 Date d'inscription mardi 17 octobre 2006 Statut Membre Dernière intervention 31 août 2007
30 août 2007 à 17:47
ça a pas l'air d'inspirer grand monde...

s'il vou pléch jé ch'ui dan la merd'ch...
0
Rejoignez-nous