Jump to content

Help, Acting up


K3STROS
 Share

Recommended Posts

Not too sure what i havent done properly at this point i have been going over it for a while. I'm also new to this. I want when i click a button on the "Settings" GUI ex. The first button, i want it to open a MsgBox(0), which it already does but then it does not give me any time to click a location to record my XY coordinates into the variable.

#include <AutoItConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <MsgBoxConstants.au3>

HotKeySet('{ESC}', "Terminate")

Global $Point = MouseGetPos()
Global $xyTEL1
Global $xyBOOTEL2
Global $xyITM
Global $xyEMPINV
Global $xyCLOBAN
Global $xyBox1
Global $xyBox2
Global $xyBox5


#Region ### START Koda GUI section ###

$Start_Exit_GUI = GUICreate("----", 228, 194, 398, 222) ; Opens GUI with start/exit buttons
GUISetBkColor(0x0000FF)

$Start_Botton = GUICtrlCreateButton("START", 0, 0, 227, 89, $WS_GROUP) ; Start button
GUICtrlSetFont(-1, 28, 400, 0, "Absolute Zero")
GUICtrlSetColor(-1, 0xFF00FF)
GUICtrlSetBkColor(-1, 0x00FF00)

$Exit_Button = GUICtrlCreateButton("EXIT", 0, 96, 227, 97, $WS_GROUP) ; Exit butto
GUICtrlSetFont(-1, 28, 400, 0, "Absolute Zero")
GUICtrlSetColor(-1, 0xFFFF00)
GUICtrlSetBkColor(-1, 0xFF0000)

$ExitLabel = GUICtrlCreateLabel("ESC", 100, 160, 26, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x00FFFF)
GUICtrlSetBkColor(-1, 0xFF0000)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Start_Botton ; What happens when Start button is clicked
            Settings()

        Case $Exit_Button ; What happens when Exit or F2 button is clicked/pressed
            Terminate()

    EndSwitch
WEnd


Func Settings()

$Settings = GUICreate("SETTINGS", 436, 315, 271, 221)
GUISetBkColor(0x0000FF)
$Settings_Label1 = GUICtrlCreateLabel("Since this is Beta0.1 Things have to be set manually.", 0, 0, 429, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xFF00FF)
$Setting_Label2 = GUICtrlCreateLabel("Simply follow the prompts", 106, 32, 216, 26)
GUICtrlSetFont(-1, 14, 800, 0, "Times New Roman")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xFF00FF)
$Settings_BUTBAN = GUICtrlCreateButton("----", 160, 104, 121, 33, $WS_GROUP)
$Settings_BUTITE = GUICtrlCreateButton("----", 160, 144, 121, 33, $WS_GROUP)
$Settings_BUTEMP = GUICtrlCreateButton("----", 160, 184, 121, 33, $WS_GROUP)
$Setting_BUTINVTAB = GUICtrlCreateButton("----", 160, 64, 121, 33, $WS_GROUP)
$Settings_BUTX = GUICtrlCreateButton("----", 160, 224, 121, 33, $WS_GROUP)
$Setting_Button_Start = GUICtrlCreateButton("----", 184, 288, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

        Case $Settings_BUTBAN
            T1_Button()

        Case $Settings_BUTITE
            ITELOC_Button()

        Case $Settings_BUTEMP
            EMPINV_Button()

        Case $Setting_BUTINVTAB
            SelectInvBoxes()

        Case $Settings_BUTX
            CLOINV_Button()

;       Case $Setting_Button_Start ;;NO CODE
;           Start()   

    EndSwitch
WEnd


EndFunc

Func Terminate()
    Exit 1
EndFunc

Func Start()
    While 1

    Call(BankTeller())
        Sleep (Random (90,200,1))

    Call(EmptyInventory())
        Sleep (Random (90,200,1))

    Call(TakeAskesBones())
        Sleep (Random (90,200,1))

    Call(CloseInventory())
        Sleep (Random (90,200,1))

    Call(SpreadBury())
         Sleep (Random (90,200,1))

    WEnd

EndFunc


Func T1_Button()

    MsgBox(0, "----", "----")

    $xyTEL1 = MouseGetPos()

    MsgBox(0, "----","----")

    Call(T2)

EndFunc

Func T2()

    MsgBox(0, "----" "----")

    $xyBOOTEL2 = MouseGetPos()

    MsgBox(0, "----", "----")

EndFunc

Func ITELOC_Button()

    MsgBox(0, "----" "----")

    $xyITM = MouseGetPos()

    MsgBox(0, "----", "----")

EndFunc


Func EMPINV_Button()

    MsgBox(0, "----", "----")

    $xyEMPINV = MouseGetPos()

    MsgBox(0, "----","----")

EndFunc


Func CLOINV_Button()

    MsgBox(0, "----", "----")

    $xyCLOBAN = MouseGetPos() ; Sets the position for the X  to close your bank

    MsgBox(0, "----", "----")

EndFunc


Func SELINVBOX_Button()

    MsgBox(16, "----", "----")

    Call(INVBOX1_POS())

    Call(INVBOX2_POS())

    Call(INVBOX3_POS())

EndFunc


Func INVBOX1_POS()

    MsgBox(0, "----", "----")

    $xyBox1 = MouseGetPos()

    MsgBox(0, "----", "----")

EndFunc


Func INVBOX2_POS()

    MsgBox(0, "----", "----")

    $xyBox2 = MouseGetPos()

    MsgBox(0, "----", "----")

EndFunc


Func INVBOX3_POS()

    MsgBox(0, "----", "----")

    $xyBox5 = MouseGetPos()

    MsgBox(0, "----", "----")

EndFunc

 

Link to comment
Share on other sites

It is hard to help address your "specific" symptom when the code that you posted is not runnable...

edit: If you are trying to automate a Web page or app then there may be better alternatives than mouseclick...

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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

×
×
  • Create New...