vbs script help required help me with this script
#1
Posted 23 April 2007 - 02:25 PM
I want the program not to wait 7 sec, but to wait till the regional setting runs (Do while loop) but how, is there is running process?
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "control.exe intl.cpl,SW_SHOWNORMAL,False"
WScript.Sleep(7000)
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{enter}")
#2
Posted 23 April 2007 - 03:33 PM
Sheriff, on Apr 23 2007, 10:25 PM, said:
I want the program not to wait 7 sec, but to wait till the regional setting runs (Do while loop) but how, is there is running process?
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "control.exe intl.cpl,SW_SHOWNORMAL,False"
WScript.Sleep(7000)
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{enter}")
I sent you a pm on how to do this, but for other members hers is the shorten code.
Quote
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim App :App = Act.ExpandEnvironmentStrings("%Windir%\System32\intl.cpl")
Dim Key :Key = Array("{tab}","{tab}","{tab}","{tab}","{Enter}")
Dim StrK
Act.Run("control.exe " & App),10,False
For Each StrK In Key
Act.AppActivate(App)
WScript.Sleep 7000
Act.SendKeys(StrK)
Next
#3
Posted 23 April 2007 - 04:46 PM
Sheriff, on Apr 23 2007, 04:25 PM, said:
I want the program not to wait 7 sec, but to wait till the regional setting runs (Do while loop) but how, is there is running process?
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "control.exe intl.cpl,SW_SHOWNORMAL,False"
WScript.Sleep(7000)
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{tab}")
WshShell.SendKeys ("{enter}")
I'm not sure what you're trying to accomplish. It looks like you are just opening the applet and then canceling it. If this is what you are doing you can just send the {esc} key without having to worry that futere versions of the applet will have a different layout.
#4
Posted 23 April 2007 - 08:15 PM
#5
Posted 23 April 2007 - 09:45 PM
Exactly what is it that you want to change? Perhaps we could provide you the appropriate registry values.
Anyways, as an answer to your original question as to how to wait till a window exists, use this code:
Do Until(WshShell.AppActivate ("Regional and Language Options")) = True
WScript.Sleep 100
Loop
This will wait till the "Regional..." window is open and active.
This post has been edited by [deXter]: 23 April 2007 - 09:46 PM
#6
Posted 24 April 2007 - 02:09 AM
[deXter], on Apr 23 2007, 10:45 PM, said:
Do Until(WshShell.AppActivate ("Regional and Language Options")) = True
WScript.Sleep 100
Loop
This will wait till the "Regional..." window is open and active.
Anyone know the way to accomplish this same wait in JScript?
I've got a pile of ancient apps and utilities I have to install this way. They're also installed on boxes with widely varying speeds (Think VIA 800MHz to AMD ~3GHz.) Setting a reasonable sleep time fails if there's a delay. And setting it high enough for the slowest box makes all the other setups painfully slow.
Kel
#7
Posted 24 April 2007 - 04:08 AM
kelaniz, on Apr 24 2007, 02:09 AM, said:
[deXter], on Apr 23 2007, 10:45 PM, said:
Anyways, as an answer to your original question as to how to wait till a window exists, use this code:
Do Until(WshShell.AppActivate ("Regional and Language Options")) = True
WScript.Sleep 100
Loop
This will wait till the "Regional..." window is open and active.
Anyone know the way to accomplish this same wait in JScript?
I've got a pile of ancient apps and utilities I have to install this way. They're also installed on boxes with widely varying speeds (Think VIA 800MHz to AMD ~3GHz.) Setting a reasonable sleep time fails if there's a delay. And setting it high enough for the slowest box makes all the other setups painfully slow.
Kel
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("control.exe intl.cpl,SW_SHOWNORMAL,False");
do
{
WScript.Sleep(100);
}while (!(WshShell.AppActivate("Regional and Language Options")));
#8
Posted 24 April 2007 - 08:19 AM
This runs Cmd promt hidden then when it finished the messagebox appears.
Quote
var Act = WScript.CreateObject("WScript.Shell");
Act.Run("%Comspec% /c @Echo Off && ping -n 4 127.0.0.1>nul",0,true);
Act.Popup("Completed Ping Cmd",7,"End Cmd",4128);
#9
Posted 24 April 2007 - 08:35 AM
Act.Run("%Comspec% /c ping -n 4 127.0.0.1",0,true);
#10
Posted 24 April 2007 - 08:42 AM
kelaniz, on Apr 24 2007, 04:09 AM, said:
[deXter], on Apr 23 2007, 10:45 PM, said:
Anyways, as an answer to your original question as to how to wait till a window exists, use this code:
Do Until(WshShell.AppActivate ("Regional and Language Options")) = True
WScript.Sleep 100
Loop
This will wait till the "Regional..." window is open and active.
Anyone know the way to accomplish this same wait in JScript?
I've got a pile of ancient apps and utilities I have to install this way. They're also installed on boxes with widely varying speeds (Think VIA 800MHz to AMD ~3GHz.) Setting a reasonable sleep time fails if there's a delay. And setting it high enough for the slowest box makes all the other setups painfully slow.
Kel
Wouldn't making a silent installer be easier?
#11
Posted 24 April 2007 - 12:42 PM
Yzöwl, on Apr 24 2007, 04:35 PM, said:
Act.Run("%Comspec% /c ping -n 4 127.0.0.1",0,true);
That was just a example of waiting for something to finish, plus it
a habbit that I have for doing VBS to Cmd. The messagebox would
not appear until the cmd session was over.
This post has been edited by gunsmokingman: 24 April 2007 - 12:44 PM
#12
Posted 25 April 2007 - 04:18 PM
jcarle, on Apr 24 2007, 09:42 AM, said:
Definitely. 99% of the stuff I install, I've managed to tweak a way to do silently. But there's a few things, specifically apps (usually older) that *require* user input, newer apps that can't be made silent (Eudora 7 Pro), apps that I want to be registered/activated and configured (Photoshop CS2), and things that aren't supposed to be silent, like Windows recovery console. I've managed to get everything silent so far, but the global sleep did become a problem on the slower boxes. This hopefully fixes that.
Kel



Help
Back to top










