gte Posted September 26, 2009 Share Posted September 26, 2009 #Include <WinAPI.au3> _WinAPI_WaitForInputIdle($hProcess[, $iTimeout = -1]) I am trying to use this for remote desktop, mstsc.exe. I've used this code and it is not working, what am I doing wrong? #Include <WinAPI.au3> while 1 if WinActive("Remote Desktop") = 1 Then $hProcess = WinGetHandle("Remote Desktop") _WinAPI_WaitForInputIdle($hProcess, -1) Sleep(500) send("{enter}") WEnd HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
picaxe Posted September 27, 2009 Share Posted September 27, 2009 This works just as well for meIf WinWait("Remote Desktop") Then ControlSend($sWinTxt, '', '[CLASS:Edit; INSTANCE:1]', '192.168.0.100' & @CRLF) Link to comment Share on other sites More sharing options...
gte Posted September 27, 2009 Author Share Posted September 27, 2009 Hi, This is not working for me, maybe because I have to wait for an interacitve log on banner to pop up? Sometimes it takes < 1 second, sometimes > 5 seconds. What do you think? This works just as well for meIf WinWait("Remote Desktop") Then ControlSend($sWinTxt, '', '[CLASS:Edit; INSTANCE:1]', '192.168.0.100' & @CRLF) HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted September 27, 2009 Author Share Posted September 27, 2009 Here is my code, I cannot get it to wait for remote desktop to be idle, as soon as mstsc starts, it immediately pops my winwait msg box?? Does this piece of code work? #Include <WinAPI.au3> while 1 $server = "[server name here]" if WinWaitActive($server & " - Remote Desktop") = 1 Then $handle = "0x005C0DC4" _WinAPI_WaitForInputIdle($handle, -1) MsgBox(0, "winwait", "winwait idle") Send("{enter}") MsgBox(0, "Message", "complete") Exit EndIf WEnd HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
gte Posted September 29, 2009 Author Share Posted September 29, 2009 Has anyone else gotten this to work? Or is there a process I can monitor on the box that I am RDP-ing into, that will go idle once logon legal banner has been posted? HP OpenView ServiceCenter keep alive scriptRemote Desktop Login Script Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now