VBS TO CLOSE APPS AND THEN OPEN IMAGE

Trying to get this vbs to close all apps, but then open an image at end.   Everything closes just fine, except it doesn't open the image

Any idea how to work around it?

Option Explicit
Dim objWMIService, objProcess, colProcess
Dim xComputer, xProcessKill, xProcessKill2, xProcessKill3, xProcessKill4, xProcessKill5, xProcessKill6, xProcessKill7, xProcessKill8, xProcessKill9, xProcessKill10
xComputer = "."
xProcessKill = "'excel.exe'"
xProcessKill2 = "'outlook.exe'"
xProcessKill3 = "'winword.exe'"
xProcessKill4 = "'powerpnt.exe'"
xProcessKill5 = "'onenote.exe'"
xProcessKill6 = "'iexplore.exe'"
xProcessKill7 = "'notepad.exe'"
xProcessKill8 = "'wordpad.exe'"
xProcessKill9 = "'mstsc.exe'"
xProcessKill10 = "'wfica32.exe'"

 
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _ 
& xComputer & "\root\cimv2") 
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next 
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill2)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next 
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill3)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill4)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill5)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill6)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill7)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next
 
Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill8)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next

Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill9)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next

Set colProcess = objWMIService.ExecQuery _
("Select * from Win32_Process Where Name = " & xProcessKill10)
On Error Resume Next
For Each objProcess in colProcess
objProcess.Terminate()
Next

--- OPEN IMAGE HERE
Set objExplorer = CreateObject("InternetExplorer.Application")
With objExplorer
    .Navigate "about:blank"
    .Visible = 1
    .Document.Title = "Show Image"
    .Toolbar=False
    .Statusbar=False
    .Top=1400
    .Left=1400
    .Height=900
    .Width=700
    .Document.Body.InnerHTML = "<img src='\\EPICAZO\PersonalWork\DOWNTIME FLYER 08182014 V1_SM.png'>"
End With

OR

CreateObject("WScript.Shell").Run "\\EPICAZO\PersonalWork\DOWNTIME FLYER 08182014 V1_SM.png"

Open in new window

epicazoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
The path contains spaces. To use the Run method, you need to enclose the path in double quotes:  
CreateObject("WScript.Shell").Run """\\EPICAZO\PersonalWork\DOWNTIME FLYER 08182014 V1_SM.png"""

Open in new window

For the HTML, you need to encode spaces with %20:
Set objExplorer = CreateObject("InternetExplorer.Application")
With objExplorer
    .Navigate "about:blank"
    .Visible = 1
    .Document.Title = "Show Image"
    .Toolbar=False
    .Statusbar=False
    .Top=1400
    .Left=1400
    .Height=900
    .Width=700
    .Document.Body.InnerHTML = "<img src='\\EPICAZO\PersonalWork\DOWNTIME%20FLYER%2008182014%20V1_SM.png'>"
End With

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
epicazoAuthor Commented:
oBdA, it doesn't open the image
0
oBdACommented:
What happens when you open a command prompt and enter
start "" "\\EPICAZO\PersonalWork\DOWNTIME FLYER 08182014 V1_SM.png"

Open in new window

If this doesn't show the picture, then either the path is incorrect, or .png is not associated with a program.
0
epicazoAuthor Commented:
thank you and sorry for the delay.   I was pulled into another project.    The CreateObject("WScript.Shell").Run """\\EPICAZO\PersonalWork\DOWNTIME FLYER 08182014 V1_SM.png""" work fine, what doesn't work is the one to open in IE.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.