Jump to content

Start and stop button?


heyhey
 Share

Recommended Posts

What I want is a GUI that shows the user a start and a stop button

(not sure if I had to put it here or at GUI section, excuse me)

My start button works, the func starts working, however, I can't get my stop button to work

(I want it to completely exit the script :), and it does just nothing)

Does anyone know what I'm doing wrong? And sorry for making 2 topics on one script, those are different questions and I assume if I post it in the other topic, it would be a bump.

#include <INet.au3>
#include <GuiButton.au3>
#include <GuiToolbar.au3>
#include <GUIConstantsEx.au3>
GUICreate("Shotbot Pro",200,120,@desktopwidth / 2,@DesktopHeight / 2)
$button =GUICtrlCreateButton("Start",0,0,100,100)
$Button2 =GUICtrlCreateButton("Stop",100,0,100,100)
$Label1 =GUICtrlCreateLabel("Shotbot pro V0.1",0,100,200,50)
GUISetState(@SW_SHOW)
While 1 
    $msg=GUIGetMsg()
    If $msg=$button Then button1()
    If $msg=$Button2 Then Button2()
WEnd
Func button1()
$color = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)
$b8 = PixelGetColor(1087,820)
$white = 15791353
$ch = 16711680
$ch2 = 16646144 
    While True
        if $b8 = $white Then
            Sleep(500)
            if $color = $ch or $ch2 Then  
                MouseClick("left")
                Send("{LALT}")
                Sleep(30)
                Send("{O}")
                Sleep(270)
            EndIf
        Else
            Sleep(500)
            if $color = $ch2 Then
                Sleep(500)
                If $color = $ch or $ch2 Then
                    Mouseclick("left")
                    Send("{LALT}")
                    Sleep(30)
                    Send("{P}")
                    Sleep(590)
                EndIf
            EndIf
        EndIf   
    WEnd
EndFunc

Func Button2()
    Exit
EndFunc
Link to comment
Share on other sites

  • Moderators

heyhey,

Try reading the Interrupting a running function tutorial in the Wiki - it will explain why you are having difficulties and how to do what you are looking to do. :)

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

I have been checking that out before, but reading it makes me feel like my english is worse than worst.

I do not understand the whole page, I thought it was made for an older version of AutoIT (Because it says "Case" and stuff), could you show me how to do it on my script? I think I will learn from it a lot easyer, sorry for being so rude :)

Link to comment
Share on other sites

  • Moderators

heyhey,

made for an older version of AutoIT (Because it says "Case" and stuff)

'"Case" and stuff' is still part of AutoIt, believe me! ;)

As I wrote the tutorial I wil accept your un-needed apology above in advance and work on your script. See you in a while. :)

M23

Edited by Melba23

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

Thank you alot, and if you don't mind me asking, what is the different between "Case" and "If"? I have only started AutoIT yesterday, I might be trying to go to fast,looking how often I feel the need to ask peoples on the forums :).

Thanks alot ;)

Link to comment
Share on other sites

  • Moderators

heyhey,

Well, I was going to until I looked at it more closely: Shotbot Pro & Shotbot pro V0.1. :)

Now go and read this and try to understand that we mean what it says - you have already been pointed there in this thread, do you have trouble understanding plain English? ;)

You are on your own now. :idiot:

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

This script is not used for Game Automation, as I would not know how to even get a macro through the gameguard, but it is simular to Game Automation (I was making the script for shooting if a crosshair turns red, yes,

but after testing that, I wasn't even able to go through gameguard, but keeping the feeling of failure is not fun, so I wanted to keep scripting the automation, since I met AutoIT during the progress of making the script, I became interested and I would love to learn more)

I understand that you are angry at me, I would be the same, I do not post this reply to attempt having you edit my script anylonger, if I were you, I would not do it either, only reason I wanted to post this reply is I don't want you to think bad off me in any way.

Just to make clear :

-I do confess that it was meant for game automation in the at first

-The "pro" in the name, does NOT mean I was going to sell the script in any possible way (the reason why I called it pro, is because I had like 5 other attempts of the scripts in my document map, I wanted to keep all of them for memory purposes, and because the name Shotbot was used... :) )

-Above statement is not even possible, unless I would be a scammer, I can't sell a script that does not work (gameguard)

-I do/did not have the inspiration to start on an other script yet, because at this point, I don't know the capatibilities (Is that spelled right?) of AutoIT

I'm sorry.

Edited by heyhey
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...