Szhlopp Posted October 3, 2010 Share Posted October 3, 2010 (edited) I downloaded the most recent Autoit version at the church computer and started to write a little lyrics helper. I think I came across a problem when I got the point of replacing LineFeeds. Here's the code: expandcollapse popup; Easy Worship Slides Helper #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <String.au3> #include <Array.au3> ; Global $CorrectCaseArray[12] = ["I", "You", "God", "Savior", "Saviour", "Lord", "Almighty", "Father", "Son", "Holy", "Spirit", "Jehovah"] ; Jehovah $hGUIMain = GUICreate("Form1", 433, 364, 192, 124) $EditMain = GUICtrlCreateEdit("", 8, 40, 409, 257) GUICtrlSetData(-1, "EditMain") $btnCorrectCapital = GUICtrlCreateButton("Correct Capitalization", 8, 312, 113, 33, $WS_GROUP) $btnSpelling = GUICtrlCreateButton("Spelling", 128, 312, 121, 33, $WS_GROUP) $inputLyric = GUICtrlCreateInput("Input1", 320, 312, 97, 21) $btnLyric = GUICtrlCreateButton("Lyric Find", 320, 336, 97, 21, $WS_GROUP) $lblInfo = GUICtrlCreateLabel("Use to help enter worship slides!!", 16, 8, 388, 25) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $btnCorrectCapital WriteDataToUser(CorrectCapital(GUICtrlRead($EditMain))) EndSwitch WEnd func CorrectCapital($StringText) ; lower case it all $StringText = StringLower($StringText) ; Double linefeeds/ double spaces $StringText = StringRegExpReplace($StringText, "\n\s?\n\s?", @CRLF) ; correct single words $WordsArray = StringRegExp($StringText, "(\w*)\s?", 3) For $I = 0 to UBound($WordsArray) - 1 if $WordsArray[$I] <> "" and $WordsArray <> " " Then $index = _ArraySearch($CorrectCaseArray, StringStripWS($WordsArray[$I], 8)) if not @error Then $WordsArray[$I] = _StringProper($WordsArray[$I]) $StringText = StringReplace($StringText, $WordsArray[$I] & " ", $CorrectCaseArray[$index] & " ") $StringText = StringReplace($StringText, " " & $WordsArray[$I], " " & $CorrectCaseArray[$index]) Else $WordsArray[$I] = StringLower($WordsArray[$I]) EndIf EndIf Next ; bad characters for $I = 128 to 255 $StringText = StringRegExpReplace($StringText, Chr($I), "") Next for $I = 0 to 31 If $I <> 10 and $I <> 13 Then $StringText = StringRegExpReplace($StringText, Chr($I), "") ;MsgBox(0, $I, $StringText) EndIf Next return $StringText EndFunc func WriteDataToUser($String) GUICtrlSetData($EditMain, $String) EndFunc Enter anything in the edit control, put a few lines, and press the 'correct capitalization' button. You'll notice in the newest version of Autoit it doesn't display LF's right(ASCII 13), It displays them as '[]' boxes. I think it has to do with StringRegEx, because my regex tester on the church computer was returning a garbage-load of those 'unprintable' characters too. Before I submit a bug request, could I get someone to check this and make sure I'm not going insane?(MUST have the newest AU3). I would update here on my main computer to try, but I'd like to finish this up without hitting bugs. Thanks for the help! EDIT: To clarify, I am NOT having this issue under Autoit 3.3.6.1 Edited October 3, 2010 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 3, 2010 Share Posted October 3, 2010 I downloaded the most recent Autoit version ...<snip>EDIT: To clarify, I am NOT having this issue under Autoit 3.3.6.1Huh? The most recent version is 3.3.6.1, so if you have the most recent version, and you are NOT having this issue under that version, then... what was the question again? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
kaotkbliss Posted October 4, 2010 Share Posted October 4, 2010 Unless he is either using a beta, or maybe a bad download from another site? in any case, I would remove autoit and redownload 3.3.6.1 from this site 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! 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