Jump to content

HELP Need to post in a IFrame


 Share

Recommended Posts

Okay, I'm making a function to post in a Neopets.com forum...I read a topic about this, but the last post was back in 2005. I tried what was said in that topic, and I get an error.

The Error I get

$Mb = $IE.document.frames.item("message_form")

The Requested Action With This object has failed.

What I've got so far.

$posttopic = $aTopicNums[(Random(0, 39, 1))]
        $maxmess = $aMessages[0]
        
        _IENavigate($IE,$Thread[1] & $posttopic)
        $IE = _IEAttach("Neopets")
        $Mb = $IE.document.frames.item("message_form")
        _IEBodyWriteHTML($Mb, $aMessages[(Random(1, $maxmess, 1))])
        _IEFormImageClick ($Post,"Submit","alt")

Source for the section of that page that I want to post in.

<br clear="all">

<a name="bottom"></a><br><br>
<form action="process_topic.phtml" method="post" name="message_form" onsubmit="return blockMultipleReplies();">
<input name="boardType" value="reply" type="hidden">
<input name="topic_id" value="112904073" type="hidden">
<input name="board_id" value="21" type="hidden">
<input name="next" value="1" type="hidden">
<table style="border: 1px solid rgb(0, 0, 0);" border="0" cellpadding="4" cellspacing="0" width="100%">
    <tbody><tr>
        <td colspan="2" class="contentModuleHeaderAlt" style="border-bottom: 1px solid rgb(0, 0, 0);" align="center"><strong>Reply to this topic</strong></td>

    </tr>

    <tr>
        <td align="center" valign="top" width="150"><script language="javascript">
<!--
var form_obj    = document.message_form;
var tags        = new Array();
tags[0]     = "[b]TEXT[/b]";
tags[1]     = "[i]TEXT[/i]";
tags[2]     = "[u]TEXT[/u]";
tags[7]     = "[font c=black s=3 f=arial]TEXT[/font]";
tags[11]    = "[quote]TEXT[/quote]";
tags[13]    = "[sup]TEXT[/sup]";
tags[14]    = "[sub]TEXT[/sub]";
tags[17]    = "[center]TEXT[/center]";
tags[20]    = "[br]";
tags[21]    = "[p]";
function insert_tag(tag_id) {
    form_obj.message.value += tags[tag_id];
textCounter(message_form.message,message_form.remLen,400);}
//-->
</script>
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td><a href="java script:;" onclick="insert_tag(0); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/bold.gif" alt="Bold" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(1); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/italics.gif" alt="Italics" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(2); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/underline.gif" alt="Underline" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(7); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/font.gif" alt="Font" border="0" height="21" width="21"></a> <br><a href="java script:;" onclick="insert_tag(11); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/quote.gif" alt="Quote" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(13); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/sup.gif" alt="Sup" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(14); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/sub.gif" alt="Sub" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(17); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/center.gif" alt="Center" border="0" height="21" width="21"></a> <br><a href="java script:;" onclick="insert_tag(20); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/br.gif" alt="Break" border="0" height="21" width="21"></a> <a href="java script:;" onclick="insert_tag(21); return false;"><img src="http://images.neopets.com/neoboards/boardIcons/postFormatting/p.gif" alt="Paragraph" border="0" height="21" width="21"></a> </td></tr></tbody></table><br clear="all"><br>
        <a href="java script:;" onclick='insertSmiley(":)"); return false;'><img src="http://images.neopets.com/neoboards/smilies/smiley.gif" alt="" border="0"></a> 
        <a href="java script:;" onclick='insertSmiley("0:-)"); return false;'><img src="http://images.neopets.com/neoboards/smilies/angel.gif" alt="" border="0"></a> 
        <a href="java script:;" onclick='insertSmiley(":o"); return false;'><img src="http://images.neopets.com/neoboards/smilies/oh.gif" alt="" border="0"></a> 
        <a href="java script:;" onclick='insertSmiley(":("); return false;'><img src="http://images.neopets.com/neoboards/smilies/sad.gif" alt="" border="0"></a> 

        <a href="java script:;" onclick='insertSmiley(":D"); return false;'><img src="http://images.neopets.com/neoboards/smilies/grin.gif" alt="" border="0"></a><br>
        <a href="java script:;" onclick='insertSmiley("B)"); return false;'><img src="http://images.neopets.com/neoboards/smilies/sunglasses.gif" alt="" border="0"></a> 
        <a href="java script:;" onclick='insertSmiley(":P"); return false;'><img src="http://images.neopets.com/neoboards/smilies/tongue.gif" alt="" border="0"></a> 
        <a href="java script:;" onclick='insertSmiley(":K"); return false;'><img src="http://images.neopets.com/neoboards/smilies/vampire.gif" alt="" border="0"></a> 
        <a href="java script:;" onclick='insertSmiley(";)"); return false;'><img src="http://images.neopets.com/neoboards/smilies/winking.gif" alt="" border="0"></a>
        </td>
        <td><textarea rows="8" cols="75" name="message" maxlength="400" onkeydown="textCounter(this.form.message,this.form.remLen,400);" onkeyup="textCounter(this.form.message,this.form.remLen,400);"></textarea></td>
    </tr>

    <tr>
        <td colspan="2" align="center">
<div style="font-size: 11px;" align="center">You have <input readonly="readonly" name="remLen" size="3" maxlength="3" value="400" style="font-size: 11px;" type="text"> characters left for your message.</div>     <br><input value="Post Your Reply" type="submit"></td>
    </tr>
</tbody></table>
</form>

</div>
Edited by SteveO
Link to comment
Share on other sites

You'd have to attach the entire source so that the DOM can be mapped.

P.S. Attaching is better than codebox's when the text is very long.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

If that is indeed the full source, this will work:

#include <IE.au3>

$sText = "enter text to send"
$url = "enter relevant url, or pass your own IE object to the form functions"

$oIE = _IECreate($url, 1)

$oForm = _IEFormGetObjByName($oIE, "message_form")
$oInput = _IEFormElementGetObjByName($oForm, "message")
_IEFormElementSetValue($oInput, $sText)
_IEFormSubmit($oForm)
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

If that is indeed the full source, this will work:

#include <IE.au3>

$sText = "enter text to send"
$url = "enter relevant url, or pass your own IE object to the form functions"

$oIE = _IECreate($url, 1)

$oForm = _IEFormGetObjByName($oIE, "message_form")
$oInput = _IEFormElementGetObjByName($oForm, "message")
_IEFormElementSetValue($oInput, $sText)
_IEFormSubmit($oForm)
Already tried this, it doesn't work.
Link to comment
Share on other sites

Already tried this, it doesn't work.

It works perfectly with the source you supplied. Attach appropriate source in the future.

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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...