Sign in to follow this  
Followers 0
fauelde

ControlSend

2 posts in this topic

#include <GUIConstantsEx.au3>


GUICreate("bot", 335, 300)


GUISetState(@SW_SHOW)
GUICtrlCreateLabel("bot", 300, 15)


GUICtrlCreateLabel("Key1", 8, 10)
$key1 = GUICtrlCreateInput("", 35, 10, 15)



GUICtrlCreateLabel("Key2", 8, 40)
$key2 = GUICtrlCreateInput("", 35, 40, 15)



GUICtrlCreateLabel("Key3", 8, 70)
$key3 = GUICtrlCreateInput("", 35, 70, 15)



GUICtrlCreateLabel("Key4", 8, 100)
$key4 = GUICtrlCreateInput("", 35, 100, 15)



GUICtrlCreateLabel("Key5", 8, 130)
$key5 = GUICtrlCreateInput("", 35, 130, 15)

$startbutton = GUICtrlCreateButton("Start", 260, 170, 60)




While 1
    $msg = GUIGetMsg()

    Select

        Case $msg = $startbutton
                  $send1 = GUICtrlRead($key1)
                  $send2 = GUICtrlRead($key2)
                  $send3 = GUICtrlRead($key3)
                  $send4 = GUICtrlRead($key4)
                  $send5 = GUICtrlRead($key5)
                  While 1
                 ControlSend ( "New Text Document - Notepad","",$send1, "" [, flag=0] )
                Sleep(500)
                     ControlSend ( "New Text Document - Notepad","",$send2, ""[, flag=0])
                    Sleep(500)
                 ControlSend ( "New Text Document - Notepad","",$send3, ""[, flag=0] )
                    Sleep(500)
                     ControlSend ( "New Text Document - Notepad","",$send4, ""[, flag=0] )
                    Sleep(500)
                     ControlSend ( "New Text Document - Notepad","",$send5, ""[, flag=0] )
                    Sleep(500)
             WEnd


        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop

    EndSelect

WEnd

Hey guys im trying to write own macro that will be sending 1,2,3,4,5 in background program, actually got problem with

ControlSend, it returns message Error:Subscript used on non-accessible variable. Got no idea what to do i'll appreciate if someone could solve it. Dont be mad if this code looks weird i'm learning c:

 

Thanks.

Share this post


Link to post
Share on other sites



Here is the syntax of how this command is supposed to be set up

ControlSend ( "title", "text", controlID, "string" [, flag] )

 

Here is what you currently have set up

ControlSend( "Window title", "Window text", "String you want to send", "string you are actually sending", Wrong usage of optional parameters)

 

the flag for controlsend is option and you do not put the "[ ]" you just put the whatever the parameter is asking for. like 1 or 0

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