Jump to content

How to make a loop but with a variable?


Recommended Posts

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.

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

Topic locked.

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...