We help IT Professionals succeed at work.

Document Scanning Using Vbscript

tracyms
tracyms asked
on
I have a scanner script that I got from here:

http://beaukey.blogspot.com/2015/09/document-scan-with-vbsscript-and-wia.html

OPTION EXPLICIT

'--- dim objects...
dim wsh, fso, objWIAdialog, objImage, imgFilename
set wsh=CreateObject("wscript.shell")
set fso=CreateObject("scripting.filesystemobject")
set objWIAdialog = CreateObject("WIA.CommonDialog") 

'--- Start the Scanner dialog box, where a scanner can be selected...
set objImage = objWIADialog.ShowAcquireImage

'--- Save and show the scan if the scan was successful...
If Not objImage Is Nothing Then 
    Randomize
    imgFilename=fso.GetSpecialFolder(2) & "\Scan2BMP" &  Int((999999 - 100000 + 1) * Rnd + 100000) & ".jpg" 
    wscript.echo "Scan stored as BMP in file: " & imgFilename
    objImage.SaveFile imgFilename 
    wsh.run(imgFilename)
End if 

Open in new window


It works fine. I would like to tweak it so after it scans, it opens Adobe (I have the full version on Adode CS) instead of windows Image Viewer. I also don’t want to save the file, just have it scan and open in Adobe – is that possible?
Comment
Watch Question

Test your restores, not your backups...
CERTIFIED EXPERT
Expert of the Year 2019
Top Expert 2016
Commented:
There is no way to open a PDF document until you save it as a file, so you will have to do that.

As I look at your code, it already includes:

   wsh.run(imgFilename)

This will open the new PDF document using whatever program is the default for PDF type files on your system.  Set that to Adobe Acrobat and you should be all set, it should open the document after saving.


»bp

Author

Commented:
Thanks!