Jump to content

ie.au3 form problem


DiskAI
 Share

Recommended Posts

thanks for DaleHohm for a great library

i'm having problem running the library in regards to form that have more than 1 submit button

the form covers a list box that would get input from the user and populate the listbox before finally submitting the whole form

i've create an automated input system reading from a txt file and populating the listbox with the content of the txt file but i only manage to get 1/5 of the info into the listbox while the rest seems to be missing somehow in the loop

the code are as follows

#include <IE.au3>

Dim $o_IE_f

Dim $o_Keywords

$o_IE = _IECreate ()

_IENavigate ($o_IE, "http://192.168.1.2")

$o_IE_f = _IEFrameGetObjByName ($o_IE, "contents")

_IEClickLinkByText ($o_IE_f, "Block Sites")

$o_IE_f = _IEFrameGetObjByName ($o_IE, "formframe")

$o_SearchForm = _IEFormGetObjByName ($o_IE_f, "formname")

$o_Keywords = _IEFormElementGetObjByName ($o_SearchForm, "AKeyword")

$file = FileOpen("list.txt", 0)

; Check if file opened for reading OK

If $file = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Read in lines of text until the EOF is reached

While 1

$line = FileReadLine($file)

If @error = -1 Then ExitLoop

_IEFormElementSetValue ($o_Keywords, $line)

$o_SubmitButton = $o_IE_f.document.getElementById ("ButtonApp")

_IELoadWait($o_SubmitButton.click,1000)

WEnd

FileClose($file)

this site cover several frames

could you point out where i went wrong

tq

i think

Link to comment
Share on other sites

Not being able to see the site, all I can do is try to follow the logic.

First, I don't see how you would ever get more than one line of the file you are reading into the text box... the SetValue does not do an append, but rather a replace of the current value.

Second, the syntax on the _IELoadWait is funky. You need to perform your .click outside the _IELoadWait and then do the _IELoadWait on the $o_IE object afterward. Also, the one second delay (1000) in the _IELoadWait has turned out not to be necessary in any of the actual scenarios I've seen.

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

Link to comment
Share on other sites

thanks for the reply

the above site is for my netgear router.

i'm trying to make an automated script to add block sites from the txt files

like i said i seems could only get 1/5 of the list into the listbox

still think i done something wrong somewhere ;)

i think

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