Jump to content

Reading lines


Recommended Posts

I need to make a sript that allows the user to enter text into an editbox, and when a button is pressed the text is read line by line. Each line needs to be read alone because the entered text on each line will be used. Im not sure if this is that clear.. but every line is going to need to be read, and all of the lines cant be read as the same value. I know that might sound a little confusing, but if you couldhelp me that would be great.

(-|_) -|- ( _|-)

Link to comment
Share on other sites

#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

;Only a close button:
;$style1 = BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU)
;GUICreate("New GUI", $GUIWidth, $GUIHeight, -1, -1, $style1)

GUICreate("New GUI", $GUIWidth, $GUIHeight)

$Edit_1 = GUICtrlCreateEdit("", 10, 10, 230, 200)
$Button_1 = GUICtrlCreateButton("OK", 80, 220, 70, 20)

GUISetState(@SW_SHOW)

While 1
   Sleep(25)
   $msg = GUIGetMsg()
   Select
   
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

      Case $msg = $Edit_1
         $Content = GUIRead($Edit_1)
         $Content = StringStripCR($Content)
         $Lines = StringSplit($Content, @LF)
         For $i = 1 To $Lines[0]
            $Line = $Lines[$i]
           ;Do with $Line whatever you want
         Next

   EndSelect

WEnd

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...