Jump to content
Sign in to follow this  
n0dy

Help in GUI

Recommended Posts

n0dy

Hello Guys,

I need some help. In GUI If Fun text written 1st in the Edit1 and then the buttton TARGET is pressed, it should copy the text in Edit1 and change it in Case , replacing the text automatically from "funnyguy spins..." with the Text given in Edit1. And same like for Edit2, if the interval is given in there, like 1000, then it should change the interval in Script from (5000) to the given Interval(1000) only.

Here is code for Script:

While 1
Switch ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5")
    Case "funnyguy spins..."
        ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "!s" )
        sleep (5000)
        ControlClick("SOK Chatpoint++", "", 12)
EndSwitch
        WEnd

Here is my code for Button and edit Box GUI :

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()

    ;Initialize variables
    Local $GUIWidth = 200, $GUIHeight = 130
    Local $Edit_1, $Edit_2,$OK1_Btn, $OK2_Btn, $msg

    #forceref $Edit_1

    ;Create window
    GUICreate("Settings", $GUIWidth, $GUIHeight)

    ;Create an edit box with no text in it
    $Edit_1 = GUICtrlCreateEdit("", 10, 10, 100, 50)
        ;Create an edit box with no text in it
    $Edit_2 = GUICtrlCreateEdit("", 10, 70, 100, 50)

    ;Create an "OK" button
    $OK1_Btn = GUICtrlCreateButton("TARGET", 110, 10, 80, 50)

    ;Create a "CANCEL" button
    $OK2_Btn = GUICtrlCreateButton("INTERVAL", 110, 70, 80, 50)

    ;Show window/Make the window visible
    GUISetState(@SW_SHOW)

    ;Loop until:
    ;- user presses Esc
    ;- user presses Alt+F4
    ;- user clicks the close button
    While 1
        ;After every loop check if the user clicked something in the GUI window
        $msg = GUIGetMsg()

        Select

            ;Check if user clicked on the close button
            Case $msg = $GUI_EVENT_CLOSE
                ;Destroy the GUI including the controls
                GUIDelete()
                ;Exit the script
                Exit

                ;Check if user clicked on the "OK" button
            Case $msg = $OK1_Btn
                MsgBox(64, "Target Set", "Target Text has been set!")

                ;Check if user clicked on the "CANCEL" button
            Case $msg = $OK2_Btn
                MsgBox(64, "Interval", "Interval has been Set")

        EndSelect

    WEnd
EndFunc   ;==>_Main

Please help guys, what must be changed.

Regards,

n0dy

Share this post


Link to post
Share on other sites
furrycow

I havent tested this at all, but shouldnt ControlGetText() have the title, text, and CONTROLID in its brackets..also ControlSetText()...

I have always thought the controlid could only be the variable which you assigned to the control..eg. $Edit_1 is the controlid for the first Edit box in your code. I dont know, your method could be completely legit, but if youre not sure, try what i am saying...

Also, i havent tested it because youve put the code in two boxes...its a whole lot easier for someone to test something if the code is just THERE if you know what i mean...plus im lazy at the moment.

Good luck.


Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites
n0dy

Oh i have given the Code in different boxes because i dont know where to put what condition. That is about what i am asking help. :huggles::D

Share this post


Link to post
Share on other sites
n0dy

Maybe it is like this?

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()

    ;Initialize variables
    Local $GUIWidth = 200, $GUIHeight = 130
    Local $Edit_1, $Edit_2,$OK1_Btn, $OK2_Btn, $msg

    #forceref $Edit_1

    ;Create window
    GUICreate("Settings", $GUIWidth, $GUIHeight)

    ;Create an edit box with no text in it
    $Edit_1 = GUICtrlCreateEdit("", 10, 10, 100, 50)
        ;Create an edit box with no text in it
    $Edit_2 = GUICtrlCreateEdit("", 10, 70, 100, 50)

    ;Create an "OK" button
    $OK1_Btn = GUICtrlCreateButton("TARGET", 110, 10, 80, 50)

    ;Create a "CANCEL" button
    $OK2_Btn = GUICtrlCreateButton("INTERVAL", 110, 70, 80, 50)

    ;Show window/Make the window visible
    GUISetState(@SW_SHOW)

    ;Loop until:
    ;- user presses Esc
    ;- user presses Alt+F4
    ;- user clicks the close button
    While 1
        ;After every loop check if the user clicked something in the GUI window
        Switch ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5")
        $Edit_1 = Case ""
            ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "!s" )
            sleep (5000)
            ControlClick("SOK Chatpoint++", "", 12)
        $msg = GUIGetMsg()
                Case Else
        ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5")
EndSwitch
        Select

            ;Check if user clicked on the close button
            Case $msg = $GUI_EVENT_CLOSE
                ;Destroy the GUI including the controls
                GUIDelete()
                ;Exit the script
                Exit

                ;Check if user clicked on the "OK" button
            Case $msg = $OK1_Btn
                MsgBox(64, "Target Set", "Target Text has been set!")

                ;Check if user clicked on the "CANCEL" button
            Case $msg = $OK2_Btn
                MsgBox(64, "Interval", "Interval has been Set")

        EndSelect

    WEnd
EndFunc   ;==>_Main

Please Correct me Guys..

Share this post


Link to post
Share on other sites
furrycow

OK, i am SERIOUSLY struggling with what you want to happen, but have a look at this:

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
_Main()

Func _Main()

    ;Initialize variables
    Local $GUIWidth = 200, $GUIHeight = 130
    Local $Edit_1, $Edit_2, $OK1_Btn, $OK2_Btn, $msg

    #forceref $Edit_1

    ;Create window
    GUICreate("Settings", $GUIWidth, $GUIHeight)

    ;Create an edit box with no text in it
    $Edit_1 = GUICtrlCreateEdit("", 10, 10, 100, 50)
    ;Create an edit box with no text in it
    $Edit_2 = GUICtrlCreateEdit("", 10, 70, 100, 50)

    ;Create an "OK" button
    $OK1_Btn = GUICtrlCreateButton("TARGET", 110, 10, 80, 50)

    ;Create a "CANCEL" button
    $OK2_Btn = GUICtrlCreateButton("INTERVAL", 110, 70, 80, 50)

    ;Show window/Make the window visible
    GUISetState(@SW_SHOW)

    ;Loop until:
    ;- user presses Esc
    ;- user presses Alt+F4
    ;- user clicks the close button
    While 1
        ;After every loop check if the user clicked something in the GUI window
        $msg = GUIGetMsg()

        Select

            ;Check if user clicked on the close button
            Case $msg = $GUI_EVENT_CLOSE
                ;Destroy the GUI including the controls
                GUIDelete()
                ;Exit the script
                Exit

                ;Check if user clicked on the "OK" button
            Case $msg = $OK1_Btn

                If ControlGetText("", "",$Edit_1) = "funnyguy spins..." Then
                    ControlSetText("", "", $Edit_2, "!s")
                    Sleep(5000)
                    ControlClick("", "", 12)
                    MsgBox(64, "Target Set", "Target Text has been set!")
                EndIf


                ;Check if user clicked on the "CANCEL" button
            Case $msg = $OK2_Btn
                MsgBox(64, "Interval", "Interval has been Set")

        EndSelect

    WEnd
EndFunc   ;==>_Main

What this does is...if you type, "funnyguy spins..." into $Edit_1 it will then put "s!" into $Edit_2.

Is that what you want?? If not, try and explain again.

Thanks


Instant Lockerz Invite - www.instantlockerzinvite.co.uk

Share this post


Link to post
Share on other sites
n0dy

OK buddy. Leave that one.

See this one with only only 1 editbox and 1 Button which is names as "Target"

#include <GUIConstantsEx.au3>
Opt('MustDeclareVars', 1)
_Main()
Func _Main()

    ;Initialize variables
    Local $GUIWidth = 200, $GUIHeight = 70
    Local $Edit_1, $OK1_Btn, $msg

    #forceref $Edit_1

    ;Create window
    GUICreate("Settings", $GUIWidth, $GUIHeight)

    ;Create an edit box with no text in it
    $Edit_1 = GUICtrlCreateEdit("", 10, 10, 100, 50)
    
    ;Create an "OK" button
    $OK1_Btn = GUICtrlCreateButton("TARGET", 110, 10, 80, 50)

    ;Show window/Make the window visible
    GUISetState(@SW_SHOW)

    ;Loop until:
    ;- user presses Esc
    ;- user presses Alt+F4
    ;- user clicks the close button
    While 1
        ;After every loop check if the user clicked something in the GUI window
        Switch ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5")
        $Edit_1 = Case ""
            ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "!s" )
            sleep (5000)
            ControlClick("SOK Chatpoint++", "", 12)
        $msg = GUIGetMsg()
                Case Else
        ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5")
EndSwitch
        Select

            ;Check if user clicked on the close button
            Case $msg = $GUI_EVENT_CLOSE
                ;Destroy the GUI including the controls
                GUIDelete()
                ;Exit the script
                Exit
        EndSelect

    WEnd
EndFunc   ;==>_Main

What i am wanting to happen is, When i Play the scrip, it is showing me GUI WINDOW OK, but when i type something in its Given edit1, it should be set as condtional Case , Like when that edit1 text is retrieved from the given Gettext tool, it should do next things like controlsettext in there as it is already fine, and then send controlclick after 5000 sleep, thats it. :D Please help buddy.

Share this post


Link to post
Share on other sites
n0dy

While 1
Switch ControlGetText ( "SOK Chatpoint++", "", "ThunderRT6TextBox5")
    Case "funnyguy spins..."
        ControlSetText("SOK Chatpoint++", "", "ThunderRT6TextBox6", "!s" )
        sleep (5000)
        ControlClick("SOK Chatpoint++", "", 12)
EndSwitch
        WEnd

Actually this is the main script, and SOK Chatpoint++ is the targeting tool. Everytime i want to change the case, i Edit the script again and again. So i thought if like the GUI i made, can work like, when i run the script, it shows me Insert text window and when i press "TARGET" button in GUI, it should replace the Case text from "funnyguy spins..." to the Input text in GUI EDIT1.It is what i am trying :D Hope u understood

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.