What I want to happen it to open the Adobe Reader, print a PDF, then continue on my merry way. What happened is that the reader would not close after the file printed. I looked on the net and found that this is a common problem with AcroRd32.exe. So, I thought I would try to kill the process after the file printed. The code to kill the process works, but I cant get that far. Once the PDF opens, the script waits and will not continue until Adobe closes. Once I manually close Adobe my "OK" message comes up and the code continues. I can't figure out how to make this work. Can someone please help. This is the code that I am using.
Function printPDF ( exportName )
set wshShell = CreateObject( "WScript.Shell" )
cmdLine = """" & "AcroRd32.exe" & """" & " /t " &_
"""" & exportName & """" & " " &_
"""" & "Kyocera Mita KM-4035" & """" & " " &_
"""" & "Kyocera Mita KM-4035" & """" & " " &_
"""" & "IP_XXX.XX.X.XX" & """"
'msgbox cmdLine
ok = wshShell.Run( cmdLine, 1, true )
set wshShell = Nothing
msgbox "OK"
'kills the adobe process
Dim objWMIService, objProcess, colProcess, strComputer,
strProcessKill
strComputer = "."
strProcessKill = "'AcroRd32.exe'"
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from
Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
End Function
Function printPDF ( exportName )
set wshShell = CreateObject( "WScript.Shell" )
cmdLine = """" & "AcroRd32.exe" & """" & " /t " &_
"""" & exportName & """" & " " &_
"""" & "Kyocera Mita KM-4035" & """" & " " &_
"""" & "Kyocera Mita KM-4035" & """" & " " &_
"""" & "IP_XXX.XX.X.XX" & """"
'msgbox cmdLine
ok = wshShell.Run( cmdLine, 1, true )
set wshShell = Nothing
msgbox "OK"
'kills the adobe process
Dim objWMIService, objProcess, colProcess, strComputer,
strProcessKill
strComputer = "."
strProcessKill = "'AcroRd32.exe'"
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from
Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
End Function