Jump to content

Recommended Posts

Posted

#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
Posted

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...