CrewXp Posted March 1, 2009 Share Posted March 1, 2009 (edited) expandcollapse popup;$possibiltiies is an array of token possibilities, 15 characters in length For $i=0 to Ubound($possibilities) $result=Submitvar($possibilities[$i]) If $result=2 Then Msgbox(0,"Correct","Token Already used. But is a valid token!") Return ElseIf IsString($result) Then;If it returns 1, unexpected message, usually means its valid, not used. Msgbox(0,"Correct","Token Not Used! Message::"&$result) Return EndIf Next Func Submitvar($varin) If StringLen($varin)<>15 Then return;Checks to see if its actually a correctly formatted variable, which is 15 characters long Dim $var[3] $var[0]=StringMid($varin, 1, 5) $var[1]=StringMid($varin, 6, 5) $var[2]=StringMid($varin, 11, 5) ; $oIE = _IECreate ("https://192.168.0.1/test/index.aspx",1,0,1,0) $oForm = _IEFormGetObjByName ($oIE, "aspnetForm") $oText = _IEFormElementGetObjByName ($oForm, "$part0") _IEFormElementSetValue ($oText, $var[0]) $oText = _IEFormElementGetObjByName ($oForm, "$part1") _IEFormElementSetValue ($oText, $var[1]) $oText = _IEFormElementGetObjByName ($oForm, "$part2") _IEFormElementSetValue ($oText, $var[2]) $oText = _IEFormElementGetObjByName ($oForm, "$part3") _IEAction ($o_signin, "click") TrayTip("","done",2) _IELoadWait ($oIE) $oDiv = _IEGetObjById ($oIE, "result") ;ConsoleWrite(_IEPropertyGet($oDiv, "innertext") & @CR) $result=_IEPropertyGet($oDiv, "innertext") _IEQuit ($oIE) If $result="Please enter a valid token." Then return 0 If $result="This token has already been used." Then return 2 return $result EndFunc I'm just now experimenting with the _IE Functions in Autoit. I want to submit this webpage 20 times, each submit/post submitting a different variable(token). But time is crucial, so I'ld like to do it at the same time. Right now, I submit a page, wait for it to load, then if $result is=2(token is correct), go to next variable. Thought1: Maybe load 20 browser tabs in advance, then SOMEHOW tell autoit to use 'those tabs' created and submit the variables to each tab using a for loop? So that way it doesnt wait till the first is sent, re-create the second window, re-submit... wait... etc etc. (Not sure how to tell autoit how to create a 'tab'. And if I figure out how, They still wont load all at once because _IELoadWait is waiting for a reply from the website so that it can return my token status) Thought2: Adlib or Coroutine is the most direct approach, but I've never used those functions before, so not sure how. Edited March 1, 2009 by CrewXp Link to comment Share on other sites More sharing options...
exodius Posted March 1, 2009 Share Posted March 1, 2009 (edited) Maybe something like this?: #include <IE.au3> $Indices = 6 ; Which will actually result in 5 Dim $oIE[$Indices] Dim $oForm[$Indices] Dim $oQuery[$Indices] For $x = 0 to UBound($oIE)-1 $oIE[$x] = _IECreate ("http://www.google.com") $oForm[$x] = _IEFormGetObjByName ($oIE[$x], "f") $oQuery[$x] = _IEFormElementGetObjByName ($oForm[$x], "q") _IEFormElementSetValue ($oQuery[$x], "AutoIt IE.au3") Next MsgBox (0, "", "Waiting for dramatic effect.") For $x = 1 to UBound($oIE)-1 _IEFormSubmit ($oForm[$x], 0) Next Edited March 1, 2009 by exodius Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now