venerdì 12 dicembre 2014

Creare QR code dinamicamente Tramite VBScript

Creare QR code dinamicamente Tramite VBScript e googleapis.
 

Function fetchDocument(strDocURL, filename)
'Create the XMLHTTP object to fetch the image
Set objXmlHTTP = CreateObject("Microsoft.XMLHTTP")

'Get the image
objXmlHTTP.Open "GET", strDocURL, False
objXmlHTTP.Send

'Create Stream object
Dim objStream
Set objStream = CreateObject("ADODB.Stream")

With objStream
'Specify stream type - we want To save binary data.
.Type = 1

'Open the stream And write binary data To the object
.Open
.Write objXmlHTTP.ResponseBody

'Save binary data To disk
.SaveToFile "C:\test" & "\" & filename

'Clean up objects
.Close
End WIth

Set objXmlHTTP = Nothing
Set objStream = Nothing
End Function

qrcodelink="http://bstnetwork.blogspot.com/2014/12/stampare-pdf-tramite-vbscript.html"
fileName="123456"

Call fetchDocument("http://chart.googleapis.com/chart?chs=300x300&cht=qr&chl="&qrcodelink&"", ""&fileName&".png")


Verrà Creato il file in C:\test\ 123456.png


Stampare PDF tramite VBScript

Se avete Necessità di stampare dei file PDF tramite VBScript
potete utilizzare Foxit Reader ( Link )

e con queste poche righe di codice potete lanciare stampe in background indicando anche la stampante:


strContentsfile="C:\test\miopdf.pdf"

PrinterPath="Nome_stampante"

Set wshShell = WScript.CreateObject ("WSCript.shell")
wshshell.run """C:\Programmi\Foxit Software\Foxit Reader\Foxit.exe "" /t "&strContentsfile&" "&PrinterPath&"", 0, True
set wshshell = nothing