Computing.Net > Forums > Programming > VBS runs prog,display msg when done

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

VBS runs prog,display msg when done

Reply to Message Icon

Name: keridbey
Date: December 19, 2007 at 11:31:28 Pacific
OS: Win2000
CPU/Ram: 2.8 Ghz / 1 Gb
Product: Dell
Comment:

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) & "\"
Next

objShell.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!



Sponsored Link
Ads by Google

Response Number 1
Name: cup
Date: December 19, 2007 at 13:34:35 Pacific
Reply:

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.


0

Response Number 2
Name: Razor2.3
Date: December 19, 2007 at 14:17:19 Pacific
Reply:

MSDN

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

objShell.Run strApp, 8, True


0

Response Number 3
Name: keridbey
Date: December 19, 2007 at 19:58:08 Pacific
Reply:

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


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: VBS runs prog,display msg when done

Know when a program is done running www.computing.net/answers/programming/know-when-a-program-is-done-running/10364.html

VB.NET service www.computing.net/answers/programming/vbnet-service/12648.html

popup msg should wait for answer www.computing.net/answers/programming/popup-msg-should-wait-for-answer/17832.html