Jump to content
Sign in to follow this  
samtan117

problems with code

Recommended Posts

samtan117

i dont know how to describe it. what its meant todo is get teh text writen from gui input and put it into notepad++ but instead of doing that its just typing a 4. Here is the code

#include <GUIConstantsEx.au3>

_Main()

Func _Main()
    Local $iGUIWidth = 300, $iGUIHeight = 250
    Local $idEdit_1, $idOK_Btn, $idCancel_Btn, $iMsg

    #forceref $idEdit_1

    GUICreate("McNews Article Creator", $iGUIWidth, $iGUIHeight)

    $idTitle_Label = GUICtrlCreateLabel("Title", 8, 10)

    $idEdit_1 = GUICtrlCreateInput("", 5, 25, 290, 25)

    $idMain_Text = GUICtrlCreateLabel ("Text", 8, 55)

    $idEdit_2 = GUICtrlCreateEdit ("", 5, 75, 290, 125)

    $idCreate_Btn = GUICtrlCreateButton("Create", 75, 210, 70, 25)

    $idUndo_Btn = GUICtrlCreateButton("AI Editor", 165, 210, 70, 25)

    GUISetState(@SW_SHOW)

    While 1
        $iMsg = GUIGetMsg()

        Select

            Case $iMsg = $GUI_EVENT_CLOSE
                GUIDelete()
                Exit

            Case $iMsg = $idCreate_Btn
                MsgBox(64, "McNews", "Creating")

                Run(@ProgramFilesDir & '\Notepad++\notepad++.exe "C:\Users\samtan117\Desktop\Article"')

                WinWaitActive("[CLASS:Notepad++]")

                Send("{up}")
                Send("{up}")
                Send("{up}")
                Send("{up}")
                Sleep(200)
                Send("" & $idEdit_1)

            Case $iMsg = $idUndo_Btn
                ;MsgBox(64, "New GU", "You clicked on the Cancel button!")

        EndSelect

    WEnd
EndFunc

 

Share this post


Link to post
Share on other sites
JLogan3o13

I believe you mean to send GUICtrlRead($idEdit_1).


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
samtan117

I believe you mean to send GUICtrlRead($idEdit_1).

​no... this doesnt seem to work. am i doing it wrong?

GUICtrlRead($idEdit_1)

            Case $iMsg = $idUndo_Btn
                ;MsgBox(64, "New GU", "You clicked on the Cancel button!")

        EndSelect

    WEnd
EndFunc

do i need to use a send command to it someway?

Share this post


Link to post
Share on other sites
JLogan3o13

"doesn't work" doesn't help us much. This works just fine for me:

#include <GUIConstantsEx.au3>

_Main()

Func _Main()
    Local $iGUIWidth = 300, $iGUIHeight = 250
    Local $idEdit_1, $idOK_Btn, $idCancel_Btn, $iMsg

    #forceref $idEdit_1

    GUICreate("McNews Article Creator", $iGUIWidth, $iGUIHeight)
    $idTitle_Label = GUICtrlCreateLabel("Title", 8, 10)
    $idEdit_1 = GUICtrlCreateInput("", 5, 25, 290, 25)
    $idMain_Text = GUICtrlCreateLabel ("Text", 8, 55)
    $idEdit_2 = GUICtrlCreateEdit ("", 5, 75, 290, 125)
    $idCreate_Btn = GUICtrlCreateButton("Create", 75, 210, 70, 25)
    $idUndo_Btn = GUICtrlCreateButton("AI Editor", 165, 210, 70, 25)
    GUISetState(@SW_SHOW)

    While 1
        $iMsg = GUIGetMsg()
            Select
                Case $iMsg = $GUI_EVENT_CLOSE
                    GUIDelete()
                    Exit
                Case $iMsg = $idCreate_Btn
                    MsgBox(64, "McNews", "Creating")
                    Run(@ProgramFilesDir & '\Notepad++\notepad++.exe "C:\Users\samtan117\Desktop\Article"')
                    WinWaitActive("[CLASS:Notepad++]")
                    Send("{up}")
                    Send("{up}")
                    Send("{up}")
                    Send("{up}")
                    Sleep(200)
                    Send("" & GUICtrlRead($idEdit_1))
                Case $iMsg = $idUndo_Btn
                    ;MsgBox(64, "New GU", "You clicked on the Cancel button!")
            EndSelect
    WEnd
EndFunc

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
samtan117

"doesn't work" doesn't help us much. This works just fine for me:

#include <GUIConstantsEx.au3>

_Main()

Func _Main()
    Local $iGUIWidth = 300, $iGUIHeight = 250
    Local $idEdit_1, $idOK_Btn, $idCancel_Btn, $iMsg

    #forceref $idEdit_1

    GUICreate("McNews Article Creator", $iGUIWidth, $iGUIHeight)
    $idTitle_Label = GUICtrlCreateLabel("Title", 8, 10)
    $idEdit_1 = GUICtrlCreateInput("", 5, 25, 290, 25)
    $idMain_Text = GUICtrlCreateLabel ("Text", 8, 55)
    $idEdit_2 = GUICtrlCreateEdit ("", 5, 75, 290, 125)
    $idCreate_Btn = GUICtrlCreateButton("Create", 75, 210, 70, 25)
    $idUndo_Btn = GUICtrlCreateButton("AI Editor", 165, 210, 70, 25)
    GUISetState(@SW_SHOW)

    While 1
        $iMsg = GUIGetMsg()
            Select
                Case $iMsg = $GUI_EVENT_CLOSE
                    GUIDelete()
                    Exit
                Case $iMsg = $idCreate_Btn
                    MsgBox(64, "McNews", "Creating")
                    Run(@ProgramFilesDir & '\Notepad++\notepad++.exe "C:\Users\samtan117\Desktop\Article"')
                    WinWaitActive("[CLASS:Notepad++]")
                    Send("{up}")
                    Send("{up}")
                    Send("{up}")
                    Send("{up}")
                    Sleep(200)
                    Send("" & GUICtrlRead($idEdit_1))
                Case $iMsg = $idUndo_Btn
                    ;MsgBox(64, "New GU", "You clicked on the Cancel button!")
            EndSelect
    WEnd
EndFunc

 

​ahh perfect thankyou i types it as send("" GUICtrlRead($idEdit_1))

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  

×