mesale0077 Posted February 8, 2012 Share Posted February 8, 2012 hi The number of words in the text but gives the number of words incorrectly #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] words count [#]", 1151, 675, 126, 31) $Edit1 = GUICtrlCreateEdit("", 32, 24, 1081, 553) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("account", 464, 592, 137, 73) $Button2 = GUICtrlCreateButton("Clear", 688, 592, 121, 73) $Input1 = GUICtrlCreateInput("", 608, 608, 65, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $AD=GUICtrlRead($Edit1) Local $line = StringSplit(($AD), ' ', 1) GUICtrlSetData($Input1,$line[0]) Case $Button2 GUICtrlSetData($Edit1,"") GUICtrlSetData($Input1,"") EndSwitch WEnd thank you now Link to comment Share on other sites More sharing options...
water Posted February 8, 2012 Share Posted February 8, 2012 What do you mean by "incorrectly"? No number, wrong number? If it's the wrong number, "how wrong"? Means: If the correct number is 11 it shows 9? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
somdcomputerguy Posted February 8, 2012 Share Posted February 8, 2012 It seems to work for me. I ran the code, typed my first name, and $Input1 showed '1'. Then I typed in my first and last name, and $Input1 showed '2'. So, as water asked, what do you mean by 'incorrect'? - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
water Posted February 8, 2012 Share Posted February 8, 2012 Replace$AD = GUICtrlRead($Edit1)with$AD = StringReplace(GUICtrlRead($Edit1), @CRLF, " ")so a new line control character is treated like a word separator. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mesale0077 Posted February 8, 2012 Author Share Posted February 8, 2012 (edited) sorry How many words are in the text exam when write in editbox eiaieaea eiaieaiue ieaieae eiaieuaie ieaie eiaaie eiaiea words "7 " piece but readıng 6 dont word 6 Edited February 8, 2012 by mesale0077 Link to comment Share on other sites More sharing options...
jaberwacky Posted February 8, 2012 Share Posted February 8, 2012 (edited) I wrote something a while back that you could look at if you want: Edit: I think a line in one of the functions became garbled. I don't rememebr what it was either.Edit: Fixed. Edited February 8, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
mesale0077 Posted February 9, 2012 Author Share Posted February 9, 2012 dont workexamplelook web pagehttp://www.wordcounttool.com/ ı need wordcountthank you now Link to comment Share on other sites More sharing options...
water Posted February 9, 2012 Share Posted February 9, 2012 (edited) You had two problems in your script: 1) Line feeds didn't count as word separators 2) Multiple spaces were counted as multiple words This should work now: #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form1 = GUICreate("[#] word count [#]", 1151, 675, 126, 31) $Edit1 = GUICtrlCreateEdit("", 32, 24, 1081, 553) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Count", 464, 592, 137, 73) $Button2 = GUICtrlCreateButton("Clear", 688, 592, 121, 73) $Input1 = GUICtrlCreateInput("", 608, 608, 65, 21) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $AD = GUICtrlRead($Edit1) $AD = StringReplace($AD, @CRLF, " ") $AD = StringStripWS($AD, 7) Local $line = StringSplit(($AD), ' ', 1) GUICtrlSetData($Input1, $line[0]) Case $Button2 GUICtrlSetData($Edit1, "") GUICtrlSetData($Input1, "") EndSwitch WEnd Edited February 9, 2012 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
mesale0077 Posted February 9, 2012 Author Share Posted February 9, 2012 thank you Link to comment Share on other sites More sharing options...
jaberwacky Posted February 9, 2012 Share Posted February 9, 2012 Sure, it works. The ouput is in the console. But, it's all good. You're good to go now. Have a good one. Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? 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