Jump to content

Using ControlSend for a window that got no Controls


Derak
 Share

Recommended Posts

Hi guys,

You all know that the template of the command ControlSend() is as follows:

ControlSend ( "title", "text", controlID, "string" )

The window I'm dealing is for a game. I've tried to use "Autoit Window Info" to detect any controls in game window but only gave me that it CLASS is CLIENT. I've even tried this though I don't if it's written right but with no success:

ControlSend ( "game client", "", "[CLASS:CLIENT]", "123" )

(The window title is not that but I'm sure that I'm writing it right in my code ^^)

I know how to use ControlSend() with Notepad because I can detect "Edit1" as a control there. However I'm now stuck with this game >.<

Btw, I'm trying to send keys to a window while it's in the background. So don't bother suggesting to use Send() :(

Any help will be appreciated :mellow:

Edited by Derak

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

let ID to 0... example:

ControlSend ( "game client", "", "", "123" )
Tried it...

With your code (ID=0), it's only keeping the game window active at all time and without sending any keys. Also, You can not go to any other windows as it get you back to the game window. ID=0 with ControlSend() is like using SendKeepActive() :mellow:

Any other suggestions? :(

Edited by Derak

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

srry I meant let it blank, as in the example I posted above... anyway are u sure u put the correct title? ( care that is case sensitive unless u use opt WinTitleMatchMode)

ohh... to let it blank :(

Yeah now it's working :mellow: but its still keeping the window active all the time. :)

And yeah.... my title is right because I got it using WinGetTitle("")

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

maybe the game has some sort of warden that keeps the window active... dunno

I think you're right :(

Your codes are working perfectly with Notepad. (Sending Keys to Notepad while the Notepad window in the background)

Actually, the command Send() works with the game fine but I need to let the game active. I'm just looking for a way to do it while the game in the background :mellow:

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

Link to comment
Share on other sites

what game is it?

Alright, here is the whole idea (I hope it helps)

It's Silkroad Online

I'm just trying to make a program that Auto Presses Numbers from 1 to 5 ("12345").If you know the game, That's for choosing the attacks from the shortcut bar bellow. I have the codes for that using Send() :

(I'm not that good in coding but I'm trying my best :mellow:)

#include <GUIConstants.au3>

HotKeySet( "{NUMPAD1}" , "Attack1")
HotKeySet( "{NUMPAD2}" , "A_Grab")
HotKeySet( "{NUMPAD3}" , "Pause")
HotKeySet( "{NUMPAD4}" , "Attack2")
HotKeySet( "{NUMPAD5}" , "GetTitle")
HotKeySet( "{=}" , "Terminate")

$Form1 = GUICreate( "Auto A4", 165, 125)
$Label1 = GUICtrlCreateLabel( "[ Num 1 ] ", 10, 22)
$Input1 = GUICtrlCreateInput( "12346" , 118, 20, 40)
$Label2 = GUICtrlCreateLabel( "< Attack > ", 62, 22, 50)
$Label3 = GUICtrlCreateLabel( "[ Num 2 ]   < A-Grab >", 10, 44)
$Label4 = GUICtrlCreateLabel( "[ Num 3 ]   < Pause >", 10, 66)
$Label5 = GUICtrlCreateLabel( "[ Num 4 ]   < A-Grab2 >", 10, 88)
$Input2 = GUICtrlCreateInput( "5" , 118, 86, 40)

GUISetState()

While 1
    
    $A = GUICtrlRead($Input1)
    $B = GUICtrlRead($Input2)
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func Attack1()
    For $i = 1 to 100000000
        Sleep(100)
        Send($A)
    Next
EndFunc

Func A_Grab()
    For $e = 1 to 100000000
              Sleep(100)
            Send($A)
            Send("g")
    Next
EndFunc

Func Pause()
    Sleep(100000000)
    Sleep(100000000)
    Sleep(100000000)
    Sleep(100000000)
    Sleep(100000000)
EndFunc

Func Attack2()
    For $i = 1 to 100000000
            Sleep(100)
            Send($B)
    Next
EndFunc

Func Terminate()
    Exit
EndFunc

Func GetTitle()
    $WGT = WinGetTitle("")
    MsgBox( 0, "The Title is" , $WGT )
EndFunc

[quote]#include <AutoIt.au3> [indent]$Nothing = Impossible[/quote] [/indent]

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