K3STROS

Help, Acting up

2 posts in this topic

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

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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

  • Similar Content

    • Mungo
      By Mungo
      After an update installation to Win 10 V.1607 (64bit) I have noticed that help does not show formatted properly anymore e.g. with Images missing, tables, headers, sample code mal formatted etc.

      However, if AutoIt3Help.exe is run as Administrator everything works fine.

      I have already uninstalled AutoIt and SciTE for AutoIt and reinstalled both in the latest version.  I have used default locations for the installation under:


      C:\Program Files (x86)\AutoIt3\...
      Any idea?

      Thanks


    • rm4453
      By rm4453
      I need to find a way to after x amount of seconds set the Autoit gui's ComboBox to next option available, and if it reaches the end of the list start back at beginning. This way I can cycle through checking if users are connected to a network. The combo is populated via a recursive file search that contains folders with each connected user's username. The ComboBox will contain something like " username\config " for every connected user. So I need to make so it cycles through constantly every X seconds I have the gui functioning, and all that I just can't get this one part to work.

      TL:DR - How do I make so an AutoIt GUI ComboBox will cycle through all of its options every X seconds, and when it reaches bottom of options cycle back to top and continue the process again.

      Thanks! I can't post any code due to NDA sorry...
    • Dequality
      By Dequality
      I honestly didn't try anything yet.
      But i was thinking about my next step would be to try creating a tetris bot for educational purpose only. Last time i created a automation script / bot for ClubPenguin, which was simply made with PixelSearch If NOT(@error) Then , bla bla u know the drill aight, so i thought i would give my self a little harder challenge instead of keep making Pixelbots, i would love to try making a Memory bot or w/e u call , i read something about memory read/record was used for Tetris bots, since i haven't used Memory, i would love to know if anyone could give me a good guide or smth to follow :-) Either a complete tetris bot guide or a guide that explains memory totally in depth ish. :-)
       
       
      Dequality. #ANY-HELP-APPRECIATET
    • Eddi96
      By Eddi96
      Hey guys!
      I need your help again. So I am working on a Project with which I can Logoff a User in a Terminal-Server (Windows Server 2012 R2), logged in as Admin. Then backup the users partition and log him back in. Sounds pretty easy for you guys, right? So my problem is... I seem to not be able to get the User ID. You can see and display the ID in a textfile with:
      Run("query user>>c:\users\example\desktop\helpmeguys.txt") This line just writes a textfile of "query user" on the desktop. This is an example on what it looks like:
       BENUTZERNAME          SITZUNGSNAME       ID  STATUS  LEERLAUF   ANMELDEZEIT
      >wg                                  console                       2  Aktiv                     17    25.07.2016 08:19

      What I need right now is the ID. Any Idea on how to read it off of the Textfile?
      Please give me examples because I am still a rookie!
       
      With kind regards
      Eddi96
       
       
    • rm4453
      By rm4453
      I can't seem to get this to work properly with the ksl classifieds website. It needs to select the second category for when you are posting an ad on the classifieds, however i can't seem to get it to select the second category, however it selects the first one just fine... "I can't post full code due to privacy nda issues..." I will answer any questions you have for any unclear parts as best as I can... Thanks!
      $tab = 0 $imUploadCount = 0 _IENavigate($ksl, "https://www.ksl.com/?nid=1126") _IELoadWait($ksl, 5) Sleep(10000) ;Set category! Local $cat = _IEGetObjById($ksl, 'cat') _IEFormElementOptionSelect($cat, $Category, 1, "byText") Sleep(10000) ;Set subcategory! Local $subcat = _IEGetObjById($ksl, 'subcat') _IEFormElementOptionSelect($subcat, $Subcategory, 1, "byText") Sleep(10000) ;Time to submit the form! Local $oIEButton_go = _IEGetObjById($ksl, 'go') _IEAction($oIEButton_go, 'click') _IELoadWait($ksl, 10) Sleep(5000) It reads the $Category & $Subcategory for a .ini file that a gui has configured based off of user selections... "drop down lists with available categories that I manually saved to a .ini" I have checked the spelling of the categories and they are all spelled correctly the categories I am testing with is FREE and FREE (items only, no businesses)