Hi there is a thread in the forum for requests
[Only registered and activated users can see links. Click Here To Register...]
But i will give u 3 ways of doing what u want, take the one that is more suitable for u.
1) Navigator opened and focus, the keys should be send to the window, you cannot use the computer for anything else.
2) Navigator opened, focus isn't needed (IE must be used...).
3) No navigator, the send data is handled by post requests.
Code:
#include <IE.au3>
Local $KeysRange[] = [65,90]
way0()
way1()
;way2() not usable in this example need POST request sent data
Func GenerateSend($length)
$raw = ""
For $i = 1 To $length
$rand = Random($KeysRange[0],$KeysRange[1],1)
$lower = Random(0,1,1);we make a random call if we want a lower case letter or not...
$letter = Chr($rand);from asscii table we go from A - Z (65-90)
If $lower Then $letter = StringLower($letter)
$raw &= $letter
Next
Return $raw
EndFunc
#Region WITH NAVIGATOR OPEN and FOCUSED
Func way0()
;While Sleep(1000)
For $i = 1 To 5
$send = GenerateSend(Random(15,35));Generates a random string between 15 and 35 chars length
Send($send & @CRLF) ;will send every 1sec...
Next
;WEnd
EndFunc
#EndRegion
#Region WITH NAVIGATOR OPEN (Internet Explorer :v)
Func way1()
$obj = _IECreate("https://www.google.com")
_IELoadWait($obj)
$indexHere = 0
$inputOrEditOrWhatever = _IEGetObjByName($obj,"q",$indexHere)
;While Sleep(1000)
$inputOrEditOrWhatever.value = GenerateSend(13) ;& @CRLF
;WEnd
EndFunc
#EndRegion
#Region WITH NAVIGATOR CLOSED
Global Const $HTTP_STATUS_OK = 200
Func HttpPost($sURL, $sData = "")
Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("POST", $sURL, False)
If (@error) Then Return SetError(1, 0, 0)
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
$oHTTP.Send($sData)
If (@error) Then Return SetError(2, 0, 0)
If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)
Return SetError(0, 0, $oHTTP.ResponseText)
EndFunc
Func way2()
While Sleep(1000)
HttpPost("http://MyURL","someparam="&GenerateSend(Random(15,35)))
WEnd
EndFunc
#EndRegion
[Edit]
Code:
_disconnect_after_time(); should be called inside loop
Case $spam
keys() ;Loop enter
;....
;Code not reachable
_disconnect_after_time()
;...
Code:
Func keys()
While 1
_disconnect_after_time()
Send ("spam")
Send ("{ENTER}")
Sleep(100)
Send ("time")
Send ("{ENTER}")
Sleep(100)
WEnd
EndFunc
Func _disconnect_after_time()
$disconnect_timed = TimerDiff($disconnect_timer)
If $disconnect_timed > $time_calc Then
exit 0
EndIf
EndFunc
[edit 2]
_disconnect_timer_calc(); never called should be called before keys when press spam button
Code:
Case $spam
_disconnect_timer_calc();
keys()
EndSwitch