Jump to content

Count How Many Words


Recommended Posts

well im working on some homework and i have to have atleast 100 words and since im typing it all on one document i cant check to see how many for each i have so is there any way to make like a GUI with an edit box , i can just paste the text in press go and it will tell me how many words i have, dont have autoit installed so i cant look at the help file :lmao:

Edited by thatsgreat2345
Link to comment
Share on other sites

  • Moderators

maybe try to do it with stringsplit, an then check the arry oO

If you did a StringSplit() why would you check the array?

Func FindWords($s_Text)
    Return Ubound(StringSplit(StringStripWS($s_Text, 7), ' ') - 1
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

|

v yes thanks SMOKEN

$MainGui = GuiCreate('Test GUI', 215, 160)

$edit = GUICtrlCreateEdit('', 10, 10, 195, 110)

$start = GUICtrlCreateButton('Convert', 80, 120, 60, 30)
$sclear = GUICtrlCreateButton('clear', 80, 150, 60, 30)
GUISetState()

While 1

    $MainMsg = GUIGetMsg()

    Select

        Case $MainMsg = - 3

            Exit

        Case $MainMsg = $start

            $TotalWords = CountWords(GUICtrlRead($edit))

            MsgBox(0, '', $TotalWords)
    EndSelect

WEnd

 Func CountWords($s_All_Text)

    Local $SplitSpaces = StringSplit(StringStripWS($s_All_Text, 7), ' ')

    Return UBound($SplitSpaces) - 1

EndFunc
Edited by thatsgreat2345
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...