Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
is there a way I can have the batch file "click" ok for me?
Set objShell = CreateObject("WScript.Shell")objShell.Run "mstsc /v: %%T /w:640 /h:480"WScript.Sleep 500objShell.AppActivate "Remote Desktop Connection"WScript.Sleep 100objShell.SendKeys "{ENTER}"
Would it work to create a system variable that contains the characters for a carriage return and then call up this variable from your VB or batch file?
Quote from: SEBNN on August 25, 2008, 09:47:55 AMWould it work to create a system variable that contains the characters for a carriage return and then call up this variable from your VB or batch file?I'm not sure.. I do not know how to do that, could you give me an example?thanks
Const ForReading = 1Set objShell = CreateObject("WScript.Shell")Set fso = CreateObject("Scripting.FileSystemObject")Set f = fso.OpenTextFile("filename.rdp", ForReading)Do Until f.AtEndOfStream strFile = f.ReadLine() objShell.Run "mstsc /w:640 /h:480" WScript.Sleep 500 objShell.AppActivate "Remote Desktop Connection" WScript.Sleep 100 objShell.SendKeys strFile WScript.Sleep 100 objShell.SendKeys "{TAB}" WScript.Sleep 100 objShell.SendKeys "{ENTER}" Loopf.Close
Set objShell = CreateObject("WScript.Shell")objShell.Run "mstsc /w:640 /h:480"WScript.Sleep 2000objShell.AppActivate "Remote Desktop Connection"WScript.Sleep 100objShell.Sendkeys "computername"WScript.Sleep 100objShell.Sendkeys "{TAB}"WScript.Sleep 100objShell.SendKeys "{ENTER}"
Why are you using remote desktop? Are these computers networked? What are you trying to do? There might be an easier approach.
Set objShell = CreateObject("WScript.Shell")objShell.Run "mstsc /w:640 /h:480"WScript.Sleep 2000objShell.AppActivate "Remote Desktop Connection"WScript.Sleep 100objShell.Sendkeys "computer 1"WScript.Sleep 100objShell.Sendkeys "{TAB}"WScript.Sleep 100objShell.SendKeys "{ENTER}" WScript.Sleep 10000objShell.SendKeys "{ENTER}"
So when I run my batch file, it loads up 30 remote connections to 30 different computers very fast, but they all stay at that same 'OK' screen, so I then have to go to each one, and click OK, and then wait for them all to load up. This is what I would like to bypass.
If I change your script to activate notepad instead of Remote desktop, then the key is pressed. This is why I'm thinking RDP will not allow sendkeys to activate inside the remote connection.
What I am doing is this - I have to Audit 1500 networked PCs via Remote Desktop using the usernames
Set objShell = CreateObject("WScript.Shell")WScript.Sleep 2000objShell.AppActivate "Computer 1 - Remote Desktop"WScript.Sleep 500objShell.SendKeys "{ENTER}" WScript.Sleep 1000objShell.AppActivate "recycle bin"WScript.Sleep 5000objShell.SendKeys "{ENTER}"
objShell.SendKeys.Computer 1 - Remote Desktop "{ENTER}"