VbScript AppActivate fails to bring focus to window


the following script does the job (sends ESC to the app and causes it to exit) IF i dont focus on a different window between the moment i run the script and the app is finished starting. if i do select another window between running the script and the app done loading, i can see the title bar for the foremost window (login) on that app blinking every 1 second, but it doesnt not close the app and it loops there until i manually focus back on the app.

when the app starts it opens up a login box named "login". the app is named "store operations manager". it doesnt matter if i bring the focus to the main window or the child window, because it defaults to the login window and as soon as i manually bring focus to it the ESC gets sent and the app exits. the same problem occurs when the script is run as a scheduled task (when there is nobody manually switching focus as i am the only one who logins to this win2003 SBS machine)

Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run """C:\Program Files\Microsoft Retail Management System\Store Operations\SOMANAGER.exe"""
Do Until Success = True
    Success = objShell.AppActivate("Store Operations Manager")
    Wscript.Sleep 1000
objShell.SendKeys ("{ESC}")

what is the problem here?
Set objShell = nothing
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leo EikelmanDirector, IT and Business DevelopmentCommented:
maybe the name is too long.  What if u do

<<<<<<<<< SNIP >>>>>>>>>>>
  Success = objShell.AppActivate("Store Op")
  Wscript.Sleep 1000
objShell.SendKeys "{ESC}"



Leo EikelmanDirector, IT and Business DevelopmentCommented:
I dont know if this is of use but it was posted on msdn

crashnetAuthor Commented:
i tried to use "store" and "login". i only need one double quote character on each side, right? cause for the path i needed THREE on each side

i dont think the msdn article applies in my case. i am using the latest version of wscript and vbscript on windows 2003
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Leo EikelmanDirector, IT and Business DevelopmentCommented:
yeah it should be only one set of double quotes

crashnetAuthor Commented:
i found a workaround: i am killing the process instead of sending {ESC} to it and it accomplishes my goal.

thanks to all,
crashnetAuthor Commented:
i would like to get a refund on this Q. i found my answer thru another forum.


Closed, 500 points refunded.
The Experts Exchange
Community Support Moderator of all Ages

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.