Jump to content

Trying to figure out _WinApi_Waitforinputidle


gte
 Share

Recommended Posts

#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
Link to comment
Share on other sites

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 me

If WinWait("Remote Desktop") Then ControlSend($sWinTxt, '', '[CLASS:Edit; INSTANCE:1]', '192.168.0.100' & @CRLF)

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...