Jump to content

Working with words in Edit box?


Recommended Posts

#include <String.au3>
#include <GUIConstants.au3>

Global $sEditText = "Autoit working-with-words-in-edit-box https://www.autoitscript.com/forum/topic/182369-working-with-words-in-edit-box/" & @CRLF & _
                    "Autoit read-edit https://www.autoitscript.com/forum/topic/182358-read-edit/"

Global $aEditLines = StringSplit($sEditText, @CRLF, $STR_NOCOUNT)

For $i = 0 to UBound($aEditLines) - 1
    Local $sWebSource = ""
    Local $aWordsOnLine = StringSplit($aEditLines[$i], ' ', $STR_NOCOUNT)
    If (Not @Error) Then
        ConsoleWrite("Getting source for webpage " & $aWordsOnLine[2] & @CRLF)
        
        $sWebSource = BinaryToString(InetRead($aWordsOnLine[2]))
        Local $hDisplay = GUICreate($aWordsOnLine[1], 600, 500, -1, -1)
        Local $edtSource = GUICtrlCreateEdit($sWebSource, 2, 2, 596, 496)

        GUISetState(@SW_SHOW, $hDisplay)

        Do
        Until (GUIGetMsg() = $GUI_EVENT_CLOSE)
        GUIDelete($hDisplay)
    EndIf
Next

I don't know what kind of data is in your edit but maybe this will help get you going.

Link to comment
Share on other sites

Good lucky:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Inet.au3>

#Region ### START Koda GUI section ### Form=
Global $hGUI = GUICreate("Youtuber", 615, 175, 192, 346)
Global $bDo = GUICtrlCreateButton("WORK", 480, 16, 129, 113)
GUICtrlCreateGroup("Word List:", 16, 16, 449, 113)
Global $eWordList = GUICtrlCreateEdit("", 32, 32, 417, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
Global $Status = GUICtrlCreateLabel("", 24, 144, 444, 17)
Global $bExit = GUICtrlCreateButton("EXIT", 480, 136, 129, 33)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $WebURL = 'https://www.google.com/search?q='
Global $aWordList, $cURL, $sSource, $sChar = ","
GUICtrlSetData($eWordList, "Word1" & $sChar & "Word2")

While 1
    Switch GUIGetMsg()
        Case -3, $bExit
            Exit
        Case $bDo
            $aWordList = StringSplit(StringStripWS(GUICtrlRead($eWordList), 7), $sChar)
            For $i = 1 To UBound($aWordList) - 1
                $cURL = $WebURL & $aWordList[$i]
                GUICtrlSetData($Status, "Getting source: " & $cURL)
                $sSource = _INetGetSource($cURL)
                GUICtrlSetData($Status, "Ready ")
                ;Do somethink
            Next
    EndSwitch
    Sleep(10)
WEnd

 

Regards,
 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...