Sign in to follow this  
Followers 0
frostchill

keystroke to inactive window. Help.

8 posts in this topic

Hello guys, i'm new here, I would like to get some help to fix my script, I'm trying to send keystroke to Fiddler Web Debugging, it seem like i have to keep the window focus to get it to work.

Func MyExit()
    Exit
EndFunc   ;==>MyExit

HotKeySet("{ESC}", "MyExit")

While True
    ControlSend("Fiddler Web Debugger", "", "", "{s}")
    Sleep(1000)
WEnd

Share this post


Link to post
Share on other sites



Before ControlSend, why not use WinActivate to give it a focus?

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

not sure what to do... I search around.

I found

If WinActive("[CLASS:Notepad]") Then
    MsgBox(0, "", "Window was active")
EndIf

Where it say Class:Notepad.. I am not sure what to put in there, I used Au3info.exe to find class, and this is what i found "Class:WindowsForms10.Window.8.app.0.ea7f4a_r11_ad1" looks kinda too long.

Where do i need to place these code?

Edited by frostchill

Share this post


Link to post
Share on other sites

Thanks a bunch man, It's working, but it just try to keep that window on top, is there a way to keep it working while it's not focus?

Share this post


Link to post
Share on other sites

Maybe you can save current window handle and then restore it after ControlSend, but still it's annoying:

Local $hCurrentWin
While True
    If WinExists("Fiddler Web Debugger") Then
        $hCurrentWin = WinGetActive()
        WinActivate("Fiddler Web Debugger")
        ControlSend("Fiddler Web Debugger", "", "", "{s}")
        WinActivate($hCurrentWin[0])
    EndIf
    Sleep(1000)
WEnd

Func WinGetActive()
    Dim $window[2]
    Dim $winlist
    $winlist = WinList()
    For $i = 1 to $winlist[0][0]
        If $winlist[$i][0] <> "" AND IsVisible($winlist[$i][1]) Then
            $window[0] = $winlist[$i][0]
            $window[1] = $winlist[$i][1]
            ExitLoop
        EndIf
    Next
    Return $window
EndFunc

Func IsVisible($handle)
    If BitAnd( WinGetState($handle), 2 ) Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc

Share this post


Link to post
Share on other sites

That's too advance for me... still noobie, prefer something simple lol

Share this post


Link to post
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
Sign in to follow this  
Followers 0