Jump to content

Send keys to an inactive window


Recommended Posts

FYI, I used the search fuction but I wasn't unable to find a solution. Sorry.

 

Hello, I'd like to know how can I convert my script in order to work on an Inactive Window so I can do other stuff while the script if ruining in the specific window/program and doesn't need to be focused. I saw the you have to use a ControlSend function, when I replace the "Send" functions of my script to "ControlSend" it just crashes, an error window pops up. Any help will be aprecciate it. Thanks in Advance

WinActivate("CS")
Opt("SendKeyDownDelay", 100)
Global $Runner

HotKeySet("{F10}", "start")
HotKeySet("{F11}", "stop")

While 1
    Sleep(500)
WEnd

; -------- Functions -------------------

Func start()
    $Runner = Not $Runner

    While $Runner
        Send("{LEFT down}")
sleep(2500)
Send("{LEFT up}")
sleep(1000)
Send("{LCTRL 350}")
sleep(1000)
Send("{LEFT down}")
sleep(3500)
Send("{LEFT up}")
sleep(2000)
Send("{DOWN down}")
Send("{LALT}")
Send("{DOWN up}")
sleep(2000)
Send("{LEFT down}")
sleep(1000)
Send("{LEFT up}")
sleep(1000)
Send("{RIGHT down}")
sleep(3000)
Send("{RIGHT up}")
sleep(1000)
Send("{LCTRL 350}")
sleep(1000)
Send("{RIGHT down}")
sleep(3000)
Send("{RIGHT up}")
sleep(5000)
Send("{RIGHT down}")
sleep(2000)
Send("{RIGHT up}")
sleep(1000)
Send("{UP down}")
Send("{d}")
Send("{UP up}")
sleep(1000)

    WEnd
EndFunc   ;==>start


Func stop()
    Exit
EndFunc   ;==>stop

 

Link to comment
Share on other sites

  • Moderators

@MiniPlop, welcome to the forum. Take a look at the Window Info Tool, in the same directory where you installed AutoIt. If you can get information on the window's controls you would like to interact with, you can then use commands like ControlSend and ControlClick to target the window specifically, whether it is active or not.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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...