5

Created an extensive batch script program to handle some automated file management and printing and I need to call a vbs file for its sendkeys operation. Is there a way to accomplish this without freezing the program?

I've tried START /WAIT my.vbs and the script freezes when it enters the .vbs

Anyone have other methods or switches you would recommend?

I would like it to run silently if at all possible, and i need the /WAIT switch because I need the sendkeys operation to complete prior to the next step in the batch file.

Anthony Miller
  • 15,101
  • 28
  • 69
  • 98
  • 2
    You "will be trying"? Try it first and report back what happens. No use trying to solve a problem that's already solved. – Cody Gray - on strike Jun 02 '11 at 15:00
  • It's a script that runs nightly, and I can't properly test it without it effecting operations during the day. Thus why I only ask "anyone have other methods or switches you would recommend?" – Anthony Miller Jun 02 '11 at 15:56
  • 1
    "the script freezes when it enters the .vbs" Plus "i need the /WAIT switch because I need the sendkeys operation to complete prior to the next step in the batch file" So, you need the vbs to complete prior to the next operation, but you don't want your script to freeze. Please elaborate, what do you want the batch script to do while it 'waits' for the sendkeys to do its job? If you explain that then maybe there's an answer for your question. In fact, if you explain that then it probably *is* the answer to your question :-) Mikki Finn –  Jun 02 '11 at 15:37
  • sorry my wording was unclear... "the script freezes when it enters the .vbs" I meant that it starts the .vbs... but the code in the .vbs doesn't run and the program hangs indefinitely. But thinking back on it, I didn't have it set to @echo off so it didn't have focus on the application. So I set @echo off and also added a run command for the application to ensure it gains focus when the sendkeys function runs next time. – Anthony Miller Jun 02 '11 at 15:56

4 Answers4

7

Instead of using START /WAIT my.vbs you could try using cscript //NoLogo //B my.vbs. You can also pass other options to cscript that way.

wimh
  • 15,072
  • 6
  • 47
  • 98
  • 1
    I think that will do the trick. I hardly ever use cscript/wscript so I completely forgot about it. I'll test it out. I setup a little test area on my local machine and will be experimenting. – Anthony Miller Jun 03 '11 at 16:08
  • 1
    This answer works perfectly for my situation. Thanks Wimmel. – Anthony Miller Jun 06 '11 at 19:19
2

Just Call The vbs file correct path

The BAT file Edit it...!!!

wscript "file-path"

Example:

wscript "D:\KmaniZoro\PGM\N++\VBS\inputbox.vbs"

Mani Kasi
  • 240
  • 1
  • 2
  • 16
0

Create the .vbs file Then open the Batch file and enter START "" "FILE PATH"

EG: Start "" "C:\Users\%Username%\Desktop\Spiritual Aid\Program\2.vbs"

IT WORKED PERFERCTLY IN MY COMPUTER.

Saji Samsaji
  • 31
  • 1
  • 4
0

timeout 5 timeout /?

TIMEOUT [/T] timeout [/NOBREAK]

Description: This utility accepts a timeout parameter to wait for the specified time period (in seconds) or until any key is pressed. It also accepts a parameter to ignore the key press.

Parameter List: /T timeout Specifies the number of seconds to wait. Valid range is -1 to 99999 seconds.

/NOBREAK                Ignore key presses and wait specified time.

/?                      Displays this help message.

NOTE: A timeout value of -1 means to wait indefinitely for a key press.

Examples:  

TIMEOUT /?
TIMEOUT /T 10
TIMEOUT /T 300 /NOBREAK
TIMEOUT /T -1
AbcAeffchen
  • 14,400
  • 15
  • 47
  • 66