Jump to content

Error using _IEFormElementSetValue


Go to solution Solved by sammy1983,

Recommended Posts

Hi,

Please take a look at the screenshot. This is a iFrame and got the iFrame info using the below code:

Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $sTxt = $iNumFrames & " frames found" & @CRLF & @CRLF
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
$oFrame = _IEFrameGetCollection($oIE, $i)
$sTxt &= _IEPropertyGet($oFrame, "innertext") & @CRLF
Next
MsgBox($MB_SYSTEMMODAL, "Frames Info", $sTxt)

There is only 1 iFrame named "0".

 Here is my code:

$oFrame = _IEFrameGetCollection($oIE, 0)
$oInput = _IEGetObjById($oFrame, "tinymce")
_IEFormElementSetValue($oInput, "Test")

and the output is:

--> IE.au3 T3.0-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType

Can someone help me with this? Thanks.

post-80752-0-60461600-1395264589_thumb.j

Link to comment
Share on other sites

It's an Internal URL. You will not be able to access that, however, I can provide any additional information. Thanks.

Providing the URL will be breach of company's security policy. Hope you understand.

Also, just trying to understand that how this could be related to URL. The script is able to recognize the iFrame as well, it's just not setting the text.

Edited by sammy1983
Link to comment
Share on other sites

Below code is used to get Frame info:

Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
Local $oFrame = 0
For $i = 0 To ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection($oIE, $i)
    $oInput = _IEGetObjById($oFrame, "tinymce")
        If @error Then
            ConsoleWrite("Frame number " & $i & ": Object not found! " & @CRLF)
        Else
            ConsoleWrite("Frame number " & $i & ": Object found! " & @CRLF)
        EndIf
Next

The output is:

--> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop
Frame number 0: Object found! 
--> IE.au3 T3.0-1 Error from function _IEFormElementSetValue, $_IEStatus_InvalidObjectType
Edited by sammy1983
Link to comment
Share on other sites

Have you reviewed >this post?

 

Ok.. so I reviewed the post and below code did Magic.

$oFrame = _IEFrameGetCollection($oIE, 0)
_IEBodyWriteHTML($oFrame, $text)
However, now another problem is this. 
Local $hEdit

    ; Create GUI
    GUICreate("Details", 900, 500)
    $hEdit = GUICtrlCreateEdit("", 2, 2, 895, 495)
    GUICtrlSetFont(-1, 9, 700)
    GUICtrlSetColor(-1, $COLOR_BLACK)
    ;GUISetState(@SW_SHOW)

    ; Set Text
    _GUICtrlEdit_SetText($hEdit, "What is the changes?" & @CRLF & @CRLF & _
            "Who will make the change?")

        $text = _GUICtrlEdit_GetText($hEdit)

Though I have given @CRLF & @CRLF, the output is shown in the screenshot. Can this also be recitified?

I assume this is because it's writing in HTML format and not in regular Text format. Any ideas?

post-80752-0-00937000-1395268123_thumb.j

Edited by sammy1983
Link to comment
Share on other sites

  • Solution

I'm confused. Are you still trying to update the tinymce control? If so, I would try <BR> or <P> instead of @CRLF since as you indicated you are writing in HTML format.

 

Yes. That made it. I replaced @CRLF with <br> and now I am able to publish text in "tinymce" element using below code. Thanks Danp2 for all your efforts.

$oFrame = _IEFrameGetCollection($oIE, 0)
_IEBodyWriteHTML($oFrame, $text)

where $text = _GUICtrlEdit_GetText($hEdit)

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