Jump to content

Quick Question


erinn
 Share

Recommended Posts

How can I get it to close the gui after I click start, but not close the program?

#include <GUIConstantsEx.au3>

GUICreate("AutoBot", 200, 100) 
GUICtrlCreateLabel("Welcome to Erin's Mobsters Bot", 30, 15)
$startbutton = GUICtrlCreateButton('Start', 60, 70, 60)
GUISetState(@SW_SHOW)


While 1
    $msg = GUIGetMsg(1)
    
    Select
    Case $msg[0] = $startbutton
        
        $x = 1
        
        Do
        Sleep(10000)
        MouseClick('left', 624, 274);hospital tab
        Sleep(10000)
        MouseClick('left', 861, 238);refresh
        Sleep(10000)
        MouseClick('left', 524, 398);first heal
        Sleep(10000)
        MouseClick('left', 529, 475);second heal
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 422, 269);fight tab
        Sleep(10000)
        MouseClick('left', 861, 238);refresh
        Sleep(10000)
        MouseClick('left', 859, 387);first attack
        Sleep(10000)
        MouseClick('left', 857, 631);second attack
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        Until $x = 2
        
        
        
    Case $msg[0] = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd
Link to comment
Share on other sites

Welcome to the forums!

Next time, please use a more descriptive topic title and add a brief description.

GUIDelete() will destroy the window.

GUISetState(@SW_HIDE) will hide it, which would be useful if you plan to show it again.

Also, since you're not changing the value of $x, it's easier to read and debug if you instead use:

While 1
    ; code
WEnd

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

does using the @sw_hide remove the item from the task bar as well?? or is there something else i can use to do that?? my script calls from items in the GUI if that matters

@erinn i dont see where your increasing $x to equal 2 and if this is for myspace mobsters im pretty sure those arnt flash links meaning you could probably use some of the IE features of AutoIt but thats just an idea.

Edited by Zmaster

A great place to start Autoit 1-2-3

Link to comment
Share on other sites

does using the @sw_hide remove the item from the task bar as well?? or is there something else i can use to do that?? my script calls from items in the GUI if that matters

@erinn i dont see where your increasing $x to equal 2 and if this is for myspace mobsters im pretty sure those arnt flash links meaning you could probably use some of the IE features of AutoIt but thats just an idea.

Yes, GUISetState(@SW_HIDE) will remove it from the taskbar.

It does not affect the tray icon, if one is being used.

I mentioned the loop as an aside, since it doesn't affect the main question.

Since the OP's intentions aren't clear, I've treated it essentially the way the interpreter will: as an endless loop.

Edited by Skruge

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Yes, GUISetState(@SW_HIDE) will remove it from the taskbar.

It does not affect the tray icon, if one is being used.

I mentioned the loop as an aside, since it doesn't affect the main question.

Since the OP's intentions aren't clear, I've treated it essentially the way the interpreter will: as an endless loop.

Thanks, I'll try the Guisetstate. And yeah, I was using the $x to make it an endless loop.

Link to comment
Share on other sites

Here is my finished project. I'm pretty new, so don't expect it to be perfect. :)

Anyways, this is for firefox. You must have 1024x768 resolution. Run firefox, go to myspace.com log in, go to your mobsters page, have it so the big MOBSTERS sign is just touching the top of the page(just click the refresh button if you're unsure). Next (you'll laugh), open another tab. Leave it empty though, this must be done, because when i found the x's and y's i had an extra tab up, and i was too lazy to fix it. Now run the script and bring up the mobsters tab (you have 10 seconds to do so). It'll start by clicking the hospital tab and healing like 9 times, then it'll fight 8 times. The end button stops the script and the pause button pauses it. Enjoy. You'll level alot. I went from 145 to 173 in about 1 1/2 days. :o Careful though, sometimes it attacks people like 10 times in a row and they get angry. hahaha

Also, sorry for posting here, but I can't post it in the section to share scripts.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.12.1
 Author:Erinn 

 Script Function: Auto Attack Other Mobsters

#ce ----------------------------------------------------------------------------

#include <GUIConstantsEx.au3>

GUICreate("AutoBot", 200, 100) 
GUICtrlCreateLabel("Welcome to Erin's Mobsters Bot", 30, 15)
$startbutton = GUICtrlCreateButton('Start', 60, 70, 60)
GUISetState(@SW_SHOW)

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{END}", "Terminate")



While 1
    $msg = GUIGetMsg(1)
    
    Select
    Case $msg[0] = $startbutton
        MsgBox(1, 'Beginning', 'Please open your Mobsters tab now.')
        GUISetState(@SW_HIDE)

        $x = 1
        
        Do
        Sleep(10000)
        MouseClick('left', 624, 274);hospital tab
        Sleep(10000)
        MouseClick('left', 861, 238);refresh
        Sleep(10000)
        MouseClick('left', 524, 398);first heal
        Sleep(10000)
        MouseClick('left', 529, 475);second heal
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 529, 475)
        Sleep(10000)
        MouseClick('left', 422, 269);fight tab
        Sleep(10000)
        MouseClick('left', 861, 238);refresh
        Sleep(10000)
        MouseClick('left', 859, 387);first attack
        Sleep(10000)
        MouseClick('left', 857, 631);second attack
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        MouseClick('left', 857, 631)
        Sleep(10000)
        Until $x = 2
        
        
        
    Case $msg[0] = $GUI_EVENT_CLOSE
        ExitLoop
    EndSelect
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc
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...