Jump to content

Recommended Posts

Posted

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

 

Posted

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?

  • Moderators
Posted

"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

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted

"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))

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
×
×
  • Create New...