Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using WshShell.Run( ), bWaitOnReturn has no effect

Posted on 2003-12-01
4
Medium Priority
?
2,771 Views
Last Modified: 2007-12-19
Here's a simple one (I hope)

The entire code follows between equal sign lines:

============================================================
Set WshShell = WScript.CreateObject("WScript.Shell")

Dim Return
bWaitOnReturn = true

Return = WshShell.Run("""C:\Program Files\Novosoft\Handy Backup\hbagent.exe"" -e HB-DAVE-LOCAL-FULL-TEST1", 1, bWaitOnReturn)

wscript.echo "All done"
============================================================

Have tried all the things I can think of to get the script to wait, to no avail. Script has always run the specified program ("hbagent.exe") but has never waited for it to finish. The "All done" eyecatcher always appears prior to the compleation of the program. I've tried using the values (all with and without the quotes) "true" "TRUE", "1", and as this example shows, a variable set to the value of "true".  The hbagent has no GUI of its own but works in conjuction with a GUI, if it's open.

I've looked long and hard before asking this question and can't find any examples that I could try, and all seem to be exactly what I've tried, but without success.

Does the bWaitOnReturn value only work if there is a displayable window??

0
Comment
Question by:daveburrow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 7

Expert Comment

by:_agj_
ID: 9855721
Return = WshShell.Run("""C:\Program Files\Novosoft\Handy Backup\hbagent.exe""

there is an extra quote(") after .Run(
0
 
LVL 1

Assisted Solution

by:anand2k
anand2k earned 400 total points
ID: 9855777
Hi,

I was having same problem, and I got these answers from EE

Please follow this URL -
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20804957.html

I have to run PKZIP to run. But for urs this code might help.

THx
Anand
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 800 total points
ID: 9857801
Follows the anad2k uses shell and wait function. If it doesn't work, then it must be the program 'hbagent.exe' spawn itself so that shell and wait think your program is finished.

Try you code with wordpad.exe. Wordpad.exe has the same effect that you cannot trap the exit code.
0
 

Author Comment

by:daveburrow
ID: 9865690
It is true, the hbagent program must spawn as the WaitForSingleObject WIN32 call also returns before the activity is complete. One suspicion I have is that the hbagent signals a different program or service to do the work. Thanks for the input.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question