Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Waiting for app to start before continuing 2

Status
Not open for further replies.

abuthemagician

IS-IT--Management
Nov 26, 2003
192
US
I have a program that takes a while to pop up after running setup.exe on certain computers. I am writting scripts to automate the install process, and wanted to know if there was a way to wait until the second window popped up before executing commands. I only have this to go by for code...

Set Running = AppActivate "SymForm Setup"
Do While Running.Status = 0
WScript.Sleep 10000 'wait ten seconds
Loop

SymForm Setup is the name of the window that pops up after the install shield wizard.

here is the rest of my code:

<package>
<job id="vbs">
<script language="VBScript">
set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "\\Ris\Software\Synergent\Symforms\Setup.exe"
WScript.Sleep 5000
Set Running = AppActivate "SymForm Setup"
Do While Running.Status = 0
WScript.Sleep 10000 'wait ten seconds
Loop
WshShell.AppActivate "SymForm Setup"
WScript.Sleep 3000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 3000
WshShell.SendKeys "{ENTER}"
WScript.Sleep 10000
WshShell.SendKeys "{ENTER}"
</script>
</job>
</package>

Also, can i send keys to a specific application? And is there a better way than WScript.Sleep to wait for the next set of options?
 
You may be trying to solve the wrong problem here. Most installers allow for a silent install. Figuring that out may save you a great deal of effort. My job is to repackage and automate software installations and I only resort to senkeys as a very last solution. If you have no choice but to use sendkeys, I would recommend googling AutoIt.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
This software cannot be installed silently, and i wanted to use vbscript to do this. Thanks for the suggestion though. Anyone else?
 
In that case, I would go to this page and get the latest version of AutoItX.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
but i don't want to run this program on every computer and learn their scripting
 
That is why you get the ActiveX component that is AutoItX. Then all you need to do is have your script copy the dll to the target machine, register it then instantiate an AutoIt object. All from within VBScript. The AutoIt object is much more robust and reliable than WScript.Shell Sendkeys.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
anyone OTHER than TomThumbKP (who should really just stick to the topic) know if what i want to do is possible, and what i should research to do it?
 
Hello abuthemagician,

Try modify this part which contains error see if you have any luck.
[tt]
bget = false
bget = AppActivate("SymForm Setup")
Do While not bget
WScript.Sleep 10000 'wait ten seconds
Loop
[/tt]
(You must be 100% certain the window is of title "SymForm Setup" or you will have an infinite loop. You have to kill it via task manager. You can of couse device something to set the max time to loop.)

regards - tsuji
 
Corrections:

Forget to correct after cut and paste... The corresponding line should be read:
[tt] bget = [red]WshShell.[/red]AppActivate("SymForm Setup")[/tt]

- tsuji
 
well, the title of the program is SymForm Setup but it still loops indefinately
 
abuthemagician,

I should really post this, my bad!
[tt]
bget = false
Do While not bget
bget = AppActivate("SymForm Setup")
WScript.Sleep 100 'wait ten seconds
Loop
[/tt]
- tsuji
 
Same correction applies!...
[tt]
bget = false
Do While not bget
bget = WshShell.AppActivate("SymForm Setup")
WScript.Sleep 100 'wait ten seconds
Loop
[/tt]
- tsuji
 
abuthemagician,
TomThumbKP was only trying to help. In fact he always trying to help. your comment
anyone OTHER than TomThumbKP (who should really just stick to the topic) know if what i want to do is possible, and what i should research to do it?
bordered on rudeness. If you notice TomThumbKP is one of the MVP's of this forum which means he helps a lot of people on a daily basis. As one of the many people who have benefitted greatly from his wisdom I ask that you please maintain a positive candor in the forum. Negative comments may discourage these fine folks from providing us with help for free! Enjoy the forums and keep smiling. Tsuji, another forum MVP will get you where you need to go!
respectfully,

Sam
 
*SDraper*
I am sorry if i sounded rude, but i was looking for a straight vbscript and he was suggesting a 3rd party solution (although it looks good).

*tsuji*
Thank you very much for that code. That solved the problem immediately, now i just have to combine my 3 scripts, so it will install all the programs in sequence... the last one is an MSI that will be installed with a /quiet switch so it will just need to be called.... In any event thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top