Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open AND CLOSE bitmaps in script

Status
Not open for further replies.

Jerz

MIS
Sep 10, 2004
102
US
I am trying to automate the display and subsequent closing of multiple bitmaps. I can accomplish by automating word as follows:
Code:
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objShape = objDoc.Shapes
objShape.AddPicture("C:\Scripts\" & (arrRoom(xval,yval)) & ".bmp")
objDoc.Saved = TRUE
  msgbox "Blah Blah Blah", 4160, "Message Text"
  Answer = InputBox("Question?","Question?",,0,0)

objWord.Quit
  More code here, then loop back to top.....

After the msgbox & inputbox, the bitmap goes away (word closes). The problems with this are its slow & ugly, and not everyone will have word. I can use the following to open the bmp:
Code:
Set objShell = CreateObject("WScript.Shell")
image = (arrRoom(xval,yval)) & ".bmp"
objShell.Run image
but objShell.quit or .close or .exit don't close the viewer.
I also tried:
Code:
ViewProgram = "rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen "
Set objWshScriptExec = objShell.Exec(ViewProgram & "C:\scripts\" & (arrRoom(xval,yval)) & ".bmp")
but can't get it closed afterward either. How can I grab the goofy viewer app and make it close within the script where I would like it to?

Thanks in advance,
Jerz
 
Make use of processid as returned by the exec object as you can see from this.
[tt] wscript.echo objWshScriptExec.processid[/tt]
Use some utility like kill.exe to kill it for instance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top