Jump to content

ControlSend Messing up the string


Recommended Posts

Greetings!

I have been trying to get send to this textarea on a website a message through ControlSend because _IEFormElementSetValue doesnt work on it, so i get the hwnd of the IE window then do the ControlSend to the window, and the message it sends doesnt type some of the letters.

The textarea

<textarea style="overflow:hidden;height:undefinedpx;" class="form-control input-sm" placeholder="Add a comment" rows="1" data-reactid=".0.3.2.1.2.0.$view.8.1.0.0.1"></textarea>

How im getting the textarea:

$comment_area = _IETagNameGetCollection($oIE,"textarea")
            for $element in $comment_area
                if $element.placeholder = "Add a comment" Then
                    _IEAction($element,"focus")
                    Sleep(1500)
                    ;_IEFormElementSetValue($element,$comment_list[$random_index])
                    ;_IEFormSubmit($element)
                    ControlSend($hIE,"","[CLASS:Internet Explorer_Server; INSTANCE:1]",$comment_list[$random_index],1)
                    ;Send("{ENTER}")
                    Sleep(3000) ;Hacer que sea random
                EndIf
            Next

When i use _IEFormElementSetValue  it changes the text on the box, but it doesn't change the value or something because when i send an Enter key it doesn't submit the message (I Also tried _IEFormSubmit)

With ControlSend it does send it but corrupted, for example: Message: Pretty nice Result: ety nice

Also i know the element is the actual one im referring because if i use _IEAction($element,"focus") it focuses the one i want.

Any help appreciated!

Link to comment
Share on other sites

56 minutes ago, mikell said:

Did you use  $hIE = _IEPropertyGet($oIE, "hwnd")   before the   ControlSend($hIE, ...)   ?

Edit
did you try _IEPropertySet($element, "innertext", "your_text")  ?

Yes the hwnd was taken before, just not on the picture.

Let me try the innertext thing.

Edit: Thanks!    _IEPropertySet($element, "innertext", "your_text") did the job!

Edited by killertone
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

×
×
  • Create New...