Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Another question for you guys...
I have created an .HTA to run a program on a closed system. I'm looking for a way to use the VB script I have to run a program, wait for the program to terminate, then show a sign on the .HTA that it's done. The indication can be a message or picture, but it should be kind of subtle; the people around the computer in question are apt to start monkeying with it if they *think* it's done, but I don't want them to know it's done until I actually go in and close the .HTA window. Here's the script I have so far:
<html><hta:application
showintaskbar = "no"
caption = "no"
border = "thick"
contextmenu = "yes"
icon = "path_to_icon.ico"
innerborder = "no"
scroll = "no"
singleinstance = "yes"
resizable = "no"
windowState = "maximize"
><body>
<body scroll="auto">
<center>
alt="logo image">Please do not touch the computer!!!</p>
<script language="VBScript">
Set objShell = CreateObject("Wscript.Shell")strApp = "C:\MyProgram.exe"
arrPath = Split(strApp, "\")For i = 0 to Ubound(arrPath) - 1
strAppPath = strAppPath & arrPath(i) & "\"
NextobjShell.CurrentDirectory = strAppPath
objShell.Run(strApp)
</script>
Unfortunately, I'm not VBS-savvy enough to know how to do this yet. What do you think? Thanks!

Are you running wsh5.1 or wsh5.6 or 5.7? On 5.6 and 5.7 you can use exec, which is slightly better. Basically you need to check whether the status is 0 and wait if it is. When the status is non zero, the job has finished.

Also: Unless you're planing on doing something with the function's return value, you don't use ().
objShell.Run strApp, 8, True

cup:
The computer the script is running on is WSH5.1. I'm more of a batch programmer; I'm still getting used to VBS. :) I think I got it working the way I need it to, though!Razor2.3:
Thanks for the link to the article! I read it, and that definitely makes sense. I'm learning more about VBS just about every day. :D

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |