Can anyone tell me why sendkeys doesnt work, it opens the device manager, goes to the wireless network card but stops performing commands on the open Network card properties dialogue box. Is there anyway to change focus to it or something?
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "devmgmt.msc"
While WshShell.AppActivate("Device Manager") = False
Wend
WshShell.AppActivate "Device Manager"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "Network adpaters"
WshShell.SendKeys "{Right}"
WshShell.SendKeys "I"
WshShell.SendKeys "I"
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{RIGHT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
Page 1 of 1
sendkeys
#2
Posted 20 August 2004 - 11:21 AM
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "devmgmt.msc"
While WshShell.AppActivate("Device Manager") = False
Wend
WshShell.AppActivate "Device Manager"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "Network adpaters" <======= (Fix Spelling with "adapters")
WshShell.SendKeys "{Right}"
WshShell.SendKeys "I"
WshShell.SendKeys "I" <======= (Remove this)
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{RIGHT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
I would assume that you are disabling a Network Adapter with this?
Seems to look better if these 2
WshShell.Run "devmgmt.msc"
While WshShell.AppActivate("Device Manager") = False
Wend
WshShell.AppActivate "Device Manager"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "Network adpaters" <======= (Fix Spelling with "adapters")
WshShell.SendKeys "{Right}"
WshShell.SendKeys "I"
WshShell.SendKeys "I" <======= (Remove this)
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{RIGHT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
I would assume that you are disabling a Network Adapter with this?
Seems to look better if these 2
#3
Posted 20 August 2004 - 02:12 PM
MHz, on Aug 20 2004, 08:21 PM, said:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "devmgmt.msc"
While WshShell.AppActivate("Device Manager") = False
Wend
WshShell.AppActivate "Device Manager"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "Network adpaters" <======= (Fix Spelling with "adapters")
WshShell.SendKeys "{Right}"
WshShell.SendKeys "I"
WshShell.SendKeys "I" <======= (Remove this)
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{RIGHT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
I would assume that you are disabling a Network Adapter with this?
Seems to look better if these 2
WshShell.Run "devmgmt.msc"
While WshShell.AppActivate("Device Manager") = False
Wend
WshShell.AppActivate "Device Manager"
WshShell.SendKeys "{Tab}"
WshShell.SendKeys "Network adpaters" <======= (Fix Spelling with "adapters")
WshShell.SendKeys "{Right}"
WshShell.SendKeys "I"
WshShell.SendKeys "I" <======= (Remove this)
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{RIGHT}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{ENTER}"
I would assume that you are disabling a Network Adapter with this?
Seems to look better if these 2
That won't work, either!
This JScript script MUST work. (save as .js)
Quote
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.Run("devmgmt.msc");
WScript.Sleep(500);
WshShell.AppActivate("Device Manager");
WScript.Sleep(500);
WshShell.SendKeys ("{Tab}");
WScript.Sleep(500);
WshShell.SendKeys ("n");
WScript.Sleep(500);
WshShell.SendKeys ("%{Right}");
WScript.Sleep(500);
WshShell.SendKeys ("{DOWN 2}");
WScript.Sleep(500);
WshShell.SendKeys ("{ENTER}");
WScript.Sleep(1000);
WshShell.SendKeys ("{TAB}");
WScript.Sleep(500);
WshShell.SendKeys ("d");
WScript.Sleep(500);
WshShell.SendKeys ("{TAB}");
WScript.Sleep(500);
WshShell.SendKeys ("{ENTER}");
WshShell.Run("devmgmt.msc");
WScript.Sleep(500);
WshShell.AppActivate("Device Manager");
WScript.Sleep(500);
WshShell.SendKeys ("{Tab}");
WScript.Sleep(500);
WshShell.SendKeys ("n");
WScript.Sleep(500);
WshShell.SendKeys ("%{Right}");
WScript.Sleep(500);
WshShell.SendKeys ("{DOWN 2}");
WScript.Sleep(500);
WshShell.SendKeys ("{ENTER}");
WScript.Sleep(1000);
WshShell.SendKeys ("{TAB}");
WScript.Sleep(500);
WshShell.SendKeys ("d");
WScript.Sleep(500);
WshShell.SendKeys ("{TAB}");
WScript.Sleep(500);
WshShell.SendKeys ("{ENTER}");
#4
Posted 20 August 2004 - 11:34 PM
@Mazin
Sorry, .js
It does work for .vbs though, which is what i interpreted. I don't use .js much.
Little mixup here?
Sorry, .js
It does work for .vbs though, which is what i interpreted. I don't use .js much.
Little mixup here?
#5
Posted 21 August 2004 - 12:24 AM
No!
You still have two mistakes in your script.
First: (in red)
Set WshShell = WScript.CreateObject("WScript.Shell")
Second:
You haven't put a sleep interval. This is necessary because Device Manager takes time to refresh itself.
NB: I used js, only, because I can support it if wildman asks more. My script should work as vbs, too. A few modifications are needed.
You still have two mistakes in your script.
First: (in red)
Set WshShell = WScript.CreateObject("WScript.Shell")
Second:
You haven't put a sleep interval. This is necessary because Device Manager takes time to refresh itself.
NB: I used js, only, because I can support it if wildman asks more. My script should work as vbs, too. A few modifications are needed.
#6
Posted 21 August 2004 - 12:35 PM
If you put wildman's script into notepad and save it as VBScript. It almost works perfectly. Turning VBScript into JavaScipt is not a good solution at all.
Please check out the syntax to "VBScript" in your favorites, in the footers of your posts.
A couple of errors does not mean that VBScript should turn to JavaScript, for the sake of your ability of not being able to interpret the language.
Please check out the syntax to "VBScript" in your favorites, in the footers of your posts.
A couple of errors does not mean that VBScript should turn to JavaScript, for the sake of your ability of not being able to interpret the language.
#7
Posted 21 August 2004 - 01:16 PM
MHz, on Aug 21 2004, 09:35 PM, said:
A couple of errors does not mean that VBScript should turn to JavaScript, for the sake of your ability of not being able to interpret the language.
Do you think really I'm not able to write a VBScript? Well, here's a working VBS for my version of JS.
save as .vbs said:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "devmgmt.msc"
WScript.Sleep(500)
WshShell.AppActivate "Device Manager"
WScript.Sleep(500)
WshShell.SendKeys "{Tab}"
WScript.Sleep(500)
WshShell.SendKeys "n"
WScript.Sleep(500)
WshShell.SendKeys "%{Right}"
WScript.Sleep(500)
WshShell.SendKeys "{DOWN 2}"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}"
WScript.Sleep(2000)
WshShell.SendKeys "{TAB}"
WScript.Sleep(500)
WshShell.SendKeys "d"
WScript.Sleep(500)
WshShell.SendKeys "{TAB}"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}"
WshShell.Run "devmgmt.msc"
WScript.Sleep(500)
WshShell.AppActivate "Device Manager"
WScript.Sleep(500)
WshShell.SendKeys "{Tab}"
WScript.Sleep(500)
WshShell.SendKeys "n"
WScript.Sleep(500)
WshShell.SendKeys "%{Right}"
WScript.Sleep(500)
WshShell.SendKeys "{DOWN 2}"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}"
WScript.Sleep(2000)
WshShell.SendKeys "{TAB}"
WScript.Sleep(500)
WshShell.SendKeys "d"
WScript.Sleep(500)
WshShell.SendKeys "{TAB}"
WScript.Sleep(500)
WshShell.SendKeys "{ENTER}"
And yes, even a single mistake should prevent a script completely from executing.
- ← looking for the new tcpip.sys ms had rlsed
- Unattended Windows 2000/XP/2003
- Does this CMDlines.txt work? →
Share this topic:
Page 1 of 1



Help
Back to top









