Sign in to follow this  
Followers 0
Skrip

_IEBodyWriteHTML - Page Error

7 posts in this topic

#1 ·  Posted (edited)

I didn't really know what to put for a title, but I need help here..

Alright, this goes to the page and strips the HTML, and loads my version of it. But when the button is clicked, it says page error and does nothing. Can anyone please identify the issue?

I thought the problem was that I wasn't loading the Javascript. Turns out I was wrong.

#include <Array.au3>
#include <IE.au3>

$ReplyTo = "Me"
$SMSTo = "1112223333"
$Carrier = "Verizon"
$Message = "Test"

$oIE = _IECreate("http://sms.dynadel.com/")
$sHTML = _IEBodyReadHTML ($oIE)
$Test = StringSplit($sHTML, 'input', 1)
$sHTML = '<script type="text/javascript" src="scripts/SACK.js"></script>'
$sHTML = $sHTML & '<script type="text/javascript" src="scripts/MainSMS.js"></script>'
$sHTML = $sHTML & '<link rel="stylesheet" type="text/css" href="styles/styles.css" />'
$sHTML = $sHTML & '<input type="text" class="inputControl" id="userName" name="userName" value="' & $ReplyTo & '" style="width: 195px; margin-bottom:5px;"/><br/>'
$sHTML = $sHTML & '<input type="text" class="inputControl" value="' & $SMSTo & '" id="phoneNumber" name="phoneNumber" style="width: 180px; margin-bottom:5px;"/><br/>'
$sHTML = $sHTML & '<input type="text" class="inputControl" id="selectCarrier" name="selectCarrier"  value="' & $Carrier & '" style="width: 200px; margin-bottom:5px;"/><br/>'
$sHTML = $sHTML & '<textarea id ="textSMS" name="textSMS" cols="5" style="margin-left:0px; width: 500px; height: 124px; font-size:small;">' & $Message & '</textarea><br/>'
$sHTML = $sHTML & '<div id="loadingimage" style="display: none; float:left; font-size:small;">'
$sHTML = $sHTML & '<img id="imagewait" src="images/progress.gif" alt="..."/> Sending...'
$sHTML = $sHTML & '</div>'
$sHTML = $sHTML & '<div>'
$sHTML = $sHTML & '<input class="buttonLeft" type="button" value="Send Message Pl0x" onclick="onclick();"/>'
$sHTML = $sHTML & '</div>'
_IEBodyWriteHTML ($oIE, $sHTML)
Edited by Firestorm

[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites



Buh-da-bump


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

This works so maybe it has something to with your onclick() function.

$sHTML = $sHTML & '<input class="buttonLeft" type="button" value="Send Message Pl0x" onclick="alert();"/>'

Share this post


Link to post
Share on other sites

This works so maybe it has something to with your onclick() function.

$sHTML = $sHTML & '<input class="buttonLeft" type="button" value="Send Message Pl0x" onclick="alert();"/>'

Yes. That time the button showed the alert. Problem with that, is that the site isn't mine. I'm just trying to make it so I can use it's service with my own HTML.

So technically, I'm using their onclick function. It works perfectly on their page, but when I load it into my HTML, it doesn't do anything - and I can't figure out why. Any ideas?


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

So is your goal simply to execute javascript on the page?

This function will add your own script to the page:

Func IEHeadInsertScript($o_object, $s_script)
 Local $o_head, $o_element
 $o_head = _IETagNameGetCollection($o_object, "head", 0)
 $o_element = $o_object.document.createElement('script')
 $o_element.type = 'text/javascript'
 $o_element.text = $s_script
 Return $o_head.appendChild($o_element)
EndFunc

and this executes arbitrary Javascript:

Func IEEval($o_object, $s_eval)
 Return $o_object.document.parentwindow.eval($s_eval)
EndFunc

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

Oh very nice! I found an alternate way to do what I wanted, but thanks. Will use for future reference.


[left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left]

Share this post


Link to post
Share on other sites

Sorry to bump this thread but i am having a similar problem.

I am using a very javascript-heavy back-office system, and it's got an iFrame that i need to enlarge with every refresh.

I don't know if its really possible but i managed to make it partially work.

Using the code below, i managed to change the size of the iFrame, but after the change i get that error on page when trying to click on objects.

Presumably because non of the javascripts seem to be working...

I need to find a way to re-activate all the javascripts on the page after the iFrame resize change.

Please go easy on me since i have very limited knowledge in this...

Thanks.

$oFrame = _IEGetObjById ($oIE, "tree")
$HTML_Source = _IEBodyReadHTML($oFrame)
$HTML_Source = StringReplace($HTML_Source, "208", "400")
$HTML_Source = StringReplace($HTML_Source, "196", "400")
_IEBodyWriteHTML ($oFrame, $HTML_Source )

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