Sign in to follow this  
Followers 0
Aston1X

How to make a loop but with a variable?

4 posts in this topic

So, I'm trying to make the bot search, then search again and again but between each searches have a random sleep interval between 1-60 seconds. I'd also like the word to be different each time. So far all I'm doing is,

; Script created by Aston1X

#include <IE.au3> 

$Search = "HackForums"

$oIE = _IECreate ("http://search.swagbucks.com/")
; This opens Internet Explorer to the SwagBucks search page
$oForm = _IEFormGetObjByName($oIE, "search")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
; This will find the search box
_IEFormElementSetValue($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait($oIE)
; Usually you don't need the IELoadWait but you do for IEFormSubmit. It just waits till the page has loaded

_IENavigate ($oIE, "http://search.swagbucks.com/")
$Search = "VirtualFragz"
$oForm = _IEFormGetObjByName($oIE, "search")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait($oIE)
sleep (1000)
_IENavigate ($oIE, "http://search.swagbucks.com/")
$Search = "Google"
$oForm = _IEFormGetObjByName($oIE, "search")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait($oIE)
sleep (6000)
_IENavigate ($oIE, "http://search.swagbucks.com/")
$Search = "Facebook"
$oForm = _IEFormGetObjByName($oIE, "search")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, $Search)
_IEFormSubmit($oForm)
_IELoadWait($oIE)
sleep (2000)

And so on, but I presume there's an easier way to do this?

Any help on how to make this easier would be appreciated. Forget those ; comments :idea: They're for my learning.

Share this post


Link to post
Share on other sites



Take a look at Random()

Share this post


Link to post
Share on other sites

Aston1X,

From the SwagBucks rules page:

"Use of any robotic, automatic, programmed or similar entry method or searches that are not deemed by the Sponsor to represent legitimate use of the Search Services will void all entries and result in disqualification."

And you want our help to make you money? :idea:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Topic locked.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0