1

I'm trying to find a way to make a simple bot that clicks on 4 positions in a minimized window without having to have focus on it. This is what I got till now:

#include <Misc.au3>


Local $hDLL = DllOpen("user32.dll")


While 1
ControlClick ( "Eclipse Flyff", "", "" ,"left" , 1 , 724 , 1067 )
ControlClick ( "Eclipse Flyff", "", "" ,"left" , 1 , 757 , 1067 )
ControlClick ( "Eclipse Flyff", "", "" ,"left" , 1 , 791 , 1067 )
ControlClick ( "Eclipse Flyff", "", "" ,"left" , 1 , 1516 , 1010 )
    If _IsPressed("10", $hDLL) Then
        ConsoleWrite("_IsPressed - Shift Key was pressed." & @CRLF)
        ; Wait until key is released.
        While _IsPressed("10", $hDLL)
             Sleep(250)
        WEnd
         ConsoleWrite("_IsPressed - Shift Key was released." & @CRLF)
    ElseIf _IsPressed("1B", $hDLL) Then
        MsgBox(0, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
        ExitLoop
    EndIf
    Sleep(250)
WEnd


DllClose($hDLL)

My problem is that it does not do a thing I think it might be blocked by the game but I'm not really sure is this still possible in AutoIt or am I asking too much cause this is my first time using it.

People tell me to use C# but I have no idea how that works with post message so I'm really having a small dilemma cause I don't want to give up on what I started.

jotik
  • 17,044
  • 13
  • 58
  • 123
Flugel Drank
  • 11
  • 1
  • 2

1 Answers1

0

Here's a working example of how to send keystrokes to a minimized control. You need to find out the ControlID first and then even while being minimized set its focus before sending some keys.

Run("notepad")
$np = WinWaitActive("[CLASS:Notepad]")
ControlSend($np, Default, "", "Active" & @CR)
$control = ControlGetFocus($np)
WinSetState($np, Default, @SW_MINIMIZE)

ControlFocus($np, Default, $control)
ControlSend($np, Default, $control, "Minimized" & @CR)
Samoth
  • 1,691
  • 17
  • 24