neazoi Posted April 20, 2015 Share Posted April 20, 2015 (edited) Hello, I am trying to read text that has been previously entered into a text area. I can do it by storing all text into a variable (like shown below), but I want to read the text now character by character. That is, read the first character and do something with it. Then read the second character and so on. Untill the text in the text area ends... How can I do this? ;Read text from input box Local $readedText = GUICtrlRead($idEditText) Edited April 20, 2015 by neazoi Link to comment Share on other sites More sharing options...
neazoi Posted April 20, 2015 Author Share Posted April 20, 2015 Never mind, I did that with ;Read text from input box Local $readedText = GUICtrlRead($idEditText) Local $char = StringSplit($readedText, "") For $i = 1 to $char[0] Local $play1 = "\alphabet\" Local $play2 = ".wav" SoundPlay(@ScriptDir &$play1&$char[$i]&$play2, 1) Next Thanks! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 20, 2015 Moderators Share Posted April 20, 2015 (edited) StringSplit the text: #include <Array.au3> $aString = StringSplit("This is my saved string", "") _ArrayDisplay($aString) Edit: Too slow Edited April 20, 2015 by JLogan3o13 "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! Link to comment Share on other sites More sharing options...
Bowmore Posted April 20, 2015 Share Posted April 20, 2015 StringSplit() used as below will give you an array with each element being a single character, You can then loop through the array doing whatever you need to with each character. Local $readedText = GUICtrlRead($idEditText) Local $arrayOfCharacters = StringSplit ( $readedText, "", $STR_NOCOUNT) "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook Link to comment Share on other sites More sharing options...
Kinshima Posted April 20, 2015 Share Posted April 20, 2015 Local $i = 1, $character While $i <= StringLen($readedText) $character = StringMid($readedText, $i, 1) ;; code ;; code $i += 1 WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now