Capcuzzz Posted October 7, 2009 Posted October 7, 2009 hi , I'm new n take some time to look at autoit, i have questions about the tutorials that come with the installation, This is the tutorials 01-search the forum expandcollapse popup; Click to a search page, enter criteria and submit. ; This sample code will: ; 1) Create a new browser window ; 2) Navigate to http://www.autoitscript.com ; 3) click on the 'forum' link ; 4) click on the 'Search' link ; 5) get the object reference for the form named 'sForm' ; 6) get the object reference for the form field 'keywords' in the form 'sForm' ; 7) enter the value 'ReadyState' into the 'keywords' field ; 8) submit the form to return the search results #include <IE.au3> #Region --- IE-Builder generated code Start --- $o_IE = _IECreate () _IENavigate ($o_IE, "http://autoitscript.com") if ! _IELinkClickByText ($o_IE, "forum") _IELoadWait($o_IE) _IELinkClickByText ($o_IE, "Forums") _IELoadWait($o_IE) Sleep(1500) _IELinkClickByText ($o_IE, "Search") _IELoadWait($o_IE) Sleep(1000) _IELinkClickByText ($o_IE, "More Search Options") _IELoadWait($o_IE) $o_SearchForm = _IEFormGetObjByName ($o_IE, "sForm") $o_Keywords = _IEFormElementGetObjByName ($o_SearchForm, "keywords") _IEFormElementSetValue ($o_Keywords, "Valuater") _IEFormSubmit ($o_SearchForm) #EndRegion --- IE-Builder generated code End --- This is the lesson 10 expandcollapse popup; This is a demonstration for Object Create, similar to Level I. ; We are using AU3Info to get the Pixel search color. #include <GuiConstants.au3> Dim $My_Color = 0xA8FF93 ; from AU3Info. Dim $Game, $MID HotKeySet("{F8}","Get_coord") HotKeySet("{F9}","Game_Bot") Opt("MouseCoordMode", 0) ;see Level I or Search Help for "options". Opt("PixelCoordMode", 0) GUICreate("Object - Game Bot", 614, 370) GUISetFont(9, 400, -1, "MS Sans Serif") $B_oIE3 = ObjCreate("Shell.Explorer.2") $Breaktime = GUICtrlCreateObj($B_oIE3, -45, -140, 540, 510) $html2 = "about:<br><br><br><br><br><br><br><br><br><br><Text>.......... Game Bots... Yes, You can Create Game Bots in AutoIt. <br><br>........... Check this easy one out!... Please Press *Enter Game* </Text>" $B_oIE3.navigate ($html2) GUICtrlCreateLabel ("*Game Bots*", 503, 80,150) GUICtrlSetFont( -1, 12, 700) GUICtrlCreateLabel ("PixelSearch", 505, 120,150) GUICtrlSetFont( -1, 12, 700) $BrkStart = GUICtrlCreateButton("&Enter Game", 505, 300, 80, 25) $BrkEnd = GUICtrlCreateButton("&Exit", 505, 330, 80, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Or $msg = $BrkEnd Then Exit EndIf If $msg = $BrkStart Then ;http://av.vet.ksu.edu/flash/curveball/curveball.swf $B_oIE3.navigate ("http://www.bluefame.com") Sleep(1500) ; wait to load $B_oIE3.navigate ("http://www.albinoblacksheep.com/flash/curveball.php") Sleep(1500) ; bypass the advertisement MsgBox(262208, "How to Play", "Move the Racket to Hit the Ball " & @CRLF & "Or, Press [F9] to Use the Game Bot ") ToolTip('Press (F9) to Use the Game Bot',0,0) EndIf WEnd Func Game_Bot() ; if $Game then $Game = True, If Not $Game then $Game = False, maybe think of $Game as "1". $Game = NOT $Game If $Game Then ToolTip('Press (F9) to Exit Game Bot',0,0) While $Game ; search left, top, right bottom for my color, color varience of 50 shades, check every 10 pixels. $ball = PixelSearch( 49, 75, 430, 330, $My_Color, 50, 10) If Not @error Then MouseClick("left", $ball[0], $ball[1], 1, 0) WEnd ToolTip("") EndFunc Func Get_coord() ; press F8 to get mouse coordinates $MID = NOT $MID While $MID $pos = MouseGetPos() ToolTip('Mouse coordinates ' & @CRLF & " X = " & $pos[0] & @CRLF & " Y = " & $pos[1],0,0) Sleep(20) WEnd ToolTip("") EndFunc my question are: [*]what if when it tries to navigate to the url, the connection timed out, what to use to have it refresh if it happens and keep going on there is nothing wrong? [*]as i tried n it timed out, the script paused, how to unpaused it without having to restart the script n open another IE? [*]in lesson 10 that comes with the installation, it opens up a bot that start the bot, and the ie was actually in the box, so if let's say i wanna combine those 2 script, how do i do that? been trying with no luck... combine here in terms of, to get all the search forum script into the box that lesson 10 have, and use the hotkey in lesson 10 to start searching the forum. so everytime i press the hotkey, it search. can some one guide me trough this pls... thanks
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