Jump to content

How to use ControlSend like Send but without showing the window


Recommended Posts

Here I use A to remove the stuff I'm using for myself. This tool when I use Send('a') it disappears, but when I use ControlSend($handle, '', '', 'a') it fails. I don't understand why it doesn't work. Can anyone help me with this situation 😰

Link to post
Share on other sites

I'm not entirely sure what you mean, but it works with both minimized and hidden windows.

Example()

Func Example()
    Run("notepad.exe", "", @SW_HIDE)
    ; or : Run("notepad.exe", "", @SW_MINIMIZE)
    Local $hWnd = WinWait("[CLASS:Notepad]", "", 10)
    ControlSend($hWnd, "", "Edit1", "A")

    Sleep(1000)
    WinSetState($hWnd, "", @SW_MAXIMIZE)
    Sleep(3000)
    WinClose($hWnd)

    WinWaitActive("[CLASS:#32770]")
    Sleep(500)
    Send("{TAB}{ENTER}")
EndFunc   ;==>Example

 

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites

This case it's different. Many times using controlsend it's not the same as Send. What I mean here is that it is possible to use controlsend like using Send but not force the window to show

Link to post
Share on other sites

The 2 functions are different (why should it otherwise be 2 functions) so asking it do the same is not logical to me.

but for details see https://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm
 

ControlSend("[active]", "", "Edit1", "A")

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...