Jump to content

Why wont it loop?!


Recommended Posts

Ok Heres my script, everything works, except, it posts/refresh's/votes/poll's just ONCE, Its not looping, it does it once, then stops. Any help?

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Azkay <azkay.s@gmail.com>
;
; Script Function: GaiaOnline MultiBot
;
; Credits: AutoIt Support Forum - Helping me out lots ~
;                 goflago - Well, The code for the autopoller is his ;) ~
; ----------------------------------------------------------------------------

#include <IE.au3>

HotKeySet("^!1", "_IniGet")
HotKeySet("^!2", "_Post")
HotKeySet("^!3", "_Poll")
HotKeySet("^!4", "_Art_Arena")
HotKeySet("^!5", "_Avatar_Arena")
HotKeySet("^!6", "_Refresher")
HotKeySet("^!{END}", "_Exit")

If FileExists("MultiBotReadMe.txt") Then
    
    TrayTip("", "Yay For Azkay, Yay For Ashwing, Yay For All", 5)
    Sleep(2500)
    TrayTip("", "", 0)
    
Else
    FileOpen("MultiBotReadMe.txt", 1)
    FileWriteLine("MultiBotReadMe.txt", "Gaia Online MultiBot.")
    FileWriteLine("MultiBotReadMe.txt", "===============================================================")
    FileWriteLine("MultiBotReadMe.txt", "Author:         Azkay <azkay.s@gmail.com>")
    FileWriteLine("MultiBotReadMe.txt", "Function:       GaiaOnline MultiBot")
    FileWriteLine("MultiBotReadMe.txt", "Credits:        AutoIt Support Forum - Helping me out lots ~")
    FileWriteLine("MultiBotReadMe.txt", "            goflago - Helping me out too ;) ~")
    FileWriteLine("MultiBotReadMe.txt", "===============================================================")
    FileWriteLine("MultiBotReadMe.txt", "NOTE :: Before running the program, go to the login screen ( Using IE ) and login using the ""Remember Me"" option.")
    FileWriteLine("MultiBotReadMe.txt", "NOTE :: Run the program then press CTRL + ALT + 1, Once you see the TrayTip, exit the program, and configure the INI.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + 1 = Gets you the Config File.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + 2 = Starts Auto Posting.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + 3 = Starts Auto Polling.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + 4 = Starts Auto Art Arena Voting.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + 4 = Starts Auto Avatar Arena.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + 6 = Starts Refresher.")
    FileWriteLine("MultiBotReadMe.txt", "Ctrl + Alt + End = Exits the Program.")
    FileWriteLine("MultiBotReadMe.txt", "===============================================================")
    FileWriteLine("MultiBotReadMe.txt", "THIS IS MY PROGRAM, I MADE IT, SO DONT GO SAYING YOU MADE IT")
    FileClose("MultiBotReadMe.txt")
    
    TrayTip("", "Dont Forget To Read The Readme", 5, 1)
    Sleep(2500)
    TrayTip("", "", 0)
EndIf

While 1
    Sleep(20)
WEnd

Func _IniGet()
    
    If FileExists("MultiBot.ini") Then
        FileCopy("MultiBot.ini", "MultiBot_Old.ini")
    EndIf
    FileOpen("MultiBot.ini", 2)
    
    ; _Post INI
    IniWrite("MultiBot.ini", "PostThread", "Url", "Url to thread")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "Reply", "Url", "Url to ""Reply"" Image")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "Message", "MessageBody", "Message body goes here")
    FileWriteLine("MultiBot.ini", "")
    
    ; _Poll INI
    IniWrite("MultiBot.ini", "PollThread", "Url", "Url to thread")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "Edit", "Url", "Url to ""Edit"" Image")
    FileWriteLine("MultiBot.ini", "")
    FileWriteLine("MultiBot.ini", "")
    
    ; _Art_Arena INI
    IniWrite("MultiBot.ini", "ArtArena", "Url", "Url to Avatar Arena main page")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "ArtVote", "Url", "Url of the image of the number you want to autovote for each image")
    FileWriteLine("MultiBot.ini", "")
    FileWriteLine("MultiBot.ini", "")
    
    ; _Avatar_Arena INI
    IniWrite("MultiBot.ini", "AvatarArena", "Url", "Url of avatar arena")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "AvatarVote", "Url", "Url of the image of the number you want to autovote for each avatar")
    FileWriteLine("MultiBot.ini", "")
    
    ; _Refresher INI
    IniWrite("MultiBot.ini", "RefreshPage", "Url", "Url to page to refresh on")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "RefreshPageTitle", "Title", "Page title AFTER Gaia :: But BEFORE the - Microsoft Internet Explorer")
    FileWriteLine("MultiBot.ini", "")
    IniWrite("MultiBot.ini", "RefreshEvery", "Interval", "Interval between refresh here")
    FileWriteLine("MultiBot.ini", "")
    FileClose("MultiBot.ini")
    
    TrayTip("", "INI Created.", 5, 1)
    Sleep(2500)
    TrayTip("", "", 0)
EndFunc   ;==>_IniGet

Func _Post()
    $oIE_Post = _IECreate (IniRead( "MultiBot.ini", "PostThread", "Url", ""))
    While 1
        _IEImgClick ($oIE_Post, IniRead( "MultiBot.ini", "Reply", "Url", ""))
        _IENavigate ($oIE_Post, "java script:emoticon('" & IniRead( "MultiBot.ini", "Message", "MessageBody", "") & "')", 0)
        $Post = _IEFormGetObjByName ($oIE_Post, "post")
        _IEFormImageClick ($Post, "Submit", "alt")
        Sleep(50000)
    WEnd
EndFunc   ;==>_Post

Func _Poll()
    $oIE_Poll = _IECreate (IniRead("MultiBot.ini", "PollThread", "Url", ""))
    
    While 1
        _IEImgClick ($oIE_Poll, IniRead("MultiBot.ini", "Edit", "Url", ""))
        $Form1 = _IEFormGetObjByName ($oIE_Poll, "post")
        $RemovePoll = _IEFormElementGetObjByName ($Form1, "delpollbtn")
        _IEAction ($RemovePoll, "click")
        _IELoadWait ($oIE_Poll)
        
        $Form2 = _IEFormGetObjByName ($oIE_Poll, "post")
        $Poll_Title = _IEFormElementGetObjByName ($Form2, "poll_title")
        $Poll_Option = _IEFormElementGetObjByName ($Form2, "add_poll_option_text")
        _IEFormElementSetValue ($Poll_Title, "=]")
        _IEFormElementSetValue ($Poll_Option, "=]")
        _IEFormImageClick ($Form2, "Submit", "alt")
        _IENavigate ($oIE_Poll, IniRead("MultiBot.ini", "PollThread", "Url", ""))
        $Poll = $oIE_Poll.document.forms (0)
        $Radio = _IEFormElementGetObjByName ($Poll, "vote_id")
        $Submit = _IEFormElementGetObjByName ($Poll, "submit")
        _IEAction ($Radio, "click")
        _IEAction ($Submit, "click")
        Sleep(20000)
    WEnd
EndFunc   ;==>_Poll

Func _Art_Arena()
    $oIE_Art_Arena = _IECreate (IniRead( "MultiBot.ini", "ArtArena", "Url", ""))
    
    While 1
        _IEImgClick ($oIE_Art_Arena, IniRead( "MultiBot.ini", "ArtVote", "Url", ""))
        _IELoadWait ($oIE_Art_Arena)
    WEnd
EndFunc   ;==>_Art_Arena

Func _Avatar_Arena()
    $oIE_Avatar_Arena = _IECreate (IniRead( "MultiBot.ini", "AvatarArena", "Url", ""))
    
    While 1
        _IEImgClick ($oIE_Avatar_Arena, IniRead( "MultiBot.ini", "AvatarVote", "Url", ""))
        _IELoadWait ($oIE_Avatar_Arena)
    WEnd
EndFunc   ;==>_Avatar_Arena

Func _Refresher()
    $oIE_Refresher = _IECreate (IniRead( "MultiBot.ini", "RefreshPage", "Url", ""))
    
    While 1
        ControlSend("Gaia :: " & IniRead( "MultiBot.ini", "RefreshPageTitle", "Title", "") & " - Microsoft Internet Explorer", "", "", "{F5}")
        Sleep( IniRead( "Multibot.ini", "RefreshEvery", "Interval", ""))
    WEnd
EndFunc   ;==>_Refresher

Func _Exit()
    Exit
EndFunc   ;==>_Exit
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Great... Now this comes up...

C:\Program Files\AutoIt3\beta\Include\IE.au3 (1000) : ==> The requested action with this object has failed.: 
Local $linktext, $found = 0, $img, $imgs = $o_object.document.images 
Local $linktext, $found = 0, $img, $imgs = $o_object.document^ ERROR
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Ok, liek, I posted this about 2am, in the morning, it is now 2am the next morning, and no replies. Is that right?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

  • Moderators

Ok, liek, I posted this about 2am, in the morning, it is now 2am the next morning, and no replies. Is that right?

Yep, that would seem to be correct.

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

  • Moderators

I replies. Does that make you happy?

Func _funcname
$var = 1
Do
;Funtion here
Until $var = 2
EndFunc

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

  • Moderators

i thought you can only have 1 while loop.

No, but any loop you have to script correctly:
Local $Count = 0
While 1
    While $Count < 30
        $Count += 1
        ToolTip($Count, 0, 0)
        Sleep(500)
    WEnd
    $Count += 1
    ToolTip($Count, 0, 20)
    If $Count = 40 Then ExitLoop
    Sleep(500)
WEnd
That's an example of 2 While loops within each other.

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

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