Jump to content
Sign in to follow this  
Wanabeelee

Form Auto submit with data from text file

Recommended Posts

Wanabeelee

I think I'm learning.

I would like to submit this for review.  I dont want to submit bad values to Untangle if my understanding is flawed. (I'm sure it is)

 

Just working on the form part at the moment.

#include <IE.au3>

Local $oIE = _IECreate("http://forums.untangle.com/listedit/add.rb")
Local $oForm = _IEFormGetObjByName($oIE, "site")
_IEFormElementSetValue ($oForm, $sitelist)
Local $oForm1 = _IEFormGetObjByName ($oIE, "category")
_IEFormElementSetValue ($oForm1, "porn-url")

The form I'm looking at looks like this:

<form action="add.rb" method="post">
Add: <input type="text" name="site"/>
<select name="category">
<option></option>
<option>aggressive-url</option>
<option>dating-url</option>
<option>drugs-url</option>
<option>ecommerce-url</option>
<option>gambling-url</option>
<option>hacking-url</option>
<option>jobsearch-url</option>
<option>mail-url</option>
<option>porn-url</option>
<option>proxy-url</option>
<option>socialnetworking-url</option>
<option>sports-url</option>
<option>vacation-url</option>
<option>violence-url</option>
</select action="add.rb">
<input type="submit" value="Add"/>
</form>

Am I on the right track?

Share this post


Link to post
Share on other sites
FrikinImpossible

Hello Wanabeelee,

You've got the right idea, but could use a little guidance:

#include <IE.au3>

$sitelist = "somesite" ;; I assume you get this from somewhere

Local $oIE = _IECreate("http://forums.untangle.com/listedit/add.rb")

Local $oForm = _IEFormGetCollection($oIE, 0) ;;  gets the first form by index 0, because the desired form does not have a name

Local $addInput = _IEFormElementGetObjByName($oForm, "site") ;;  Find the form element by name "site"
_IEFormElementSetValue ( $addInput, $sitelist)

Local $categorySelect = _IEFormElementGetObjByName($oForm, "category") ;; Find the form element by name "category"
_IEFormElementOptionSelect($categorySelect, "porn-url", 1, "byText")  ;; refer to help file to understand this better (Google the function)

_IEFormSubmit($oForm)

Comment out or delete "_IEFormSubmit($oForm)" if you would like to test filling out the form without actually submitting it!

I hope this helps! Good luck!

Edited by FrikinImpossible

Share this post


Link to post
Share on other sites
trancexx

You can do it by not using IE. For example like this:

#include "Winhttp.au3"


$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, "forums.untangle.com")
_WinHttpSimpleFormFill($hConnect, "listedit/add.rb", "index:0", "name:category", "aggressive-url", "name:site", "aa.something.htm")

; Fill new form now to commit
$sRead = _WinHttpSimpleFormFill($hConnect, "listedit/add.rb", "name:commit")


_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

; See returned html
ConsoleWrite($sRead & @CRLF)

♡♡♡

.

eMyvnE

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.