PDA

View Full Version : VBS Problem (very easy)


kiwipenguin
09-23-2002, 08:42 PM
Can anyone tell me how to do the following? Open a local application, wait for it to fully open and then set it as the active window. I have the following code, but it doesn't seem to find the exe file.



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

ReturnCode = WshShell.Run("C:\Program Files\FirstClass\Fcc32.exe", 1, True)

WshShell.AppActivate "FirstClass Login"



The error I get is "file not found" on the ReturnCode line. You'll have to excuse my ignorance in VB Scripting too.

Cheers

inkedmn
09-24-2002, 12:08 PM
i guess the obvious first question is...

does that file exist in that directory?

stuka
09-24-2002, 12:52 PM
Another thought: do you need to escape your \s?

kmj
09-24-2002, 02:19 PM
dan says you don't have to escape your backslashes in VB... he's the guy around here that knows that stuff. :)

So it's back to inky's question... are you absolutely sure the file is there?

gish
09-24-2002, 02:47 PM
or you have the proper file/execute permissions.....

kiwipenguin
09-24-2002, 06:08 PM
Yeah, positive. I tried that code with the full path the Word as well and it told me it didn't exist. I got it to open using the shell.open method, but I can't get VB to wait for the app to open before moving on to the next part of the code.

TheBeansprout
09-11-2003, 01:16 PM
Try using DOS-style directory naming, it might work.