ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Clipboard Help+Spell

3 Feature Ideas

<< < (2/5) > >>

ewemoa:
4) Word count tool

I'd love to be able to know how many words there are in any copied text items listed in the Main Window, or even as an option to display that information in the Quick Paste Menu for each item that appears there.
-jshare (December 21, 2011, 04:34 AM)
--- End quote ---

Below is an initial attempt at an LBA script to report line and word count for the current selection -- the result comes up as a dialog box so it doesn't match the request exactly.


--- Code: Autohotkey ---ChangeText(InputText){  Lines := []  Pattern := "mO)^(.*)$"  Start := 1  LineCnt := 0  While (True)  {    FoundPos := RegExMatch(InputText, Pattern, mObj, Start)    If (ErrorLevel != 0)    {      OutputDebug, % "RegExMatch ErrorLevel: " . ErrorLevel      SoundBeep      Return    }    If (FoundPos == 0)    {      Break    }    Start := FoundPos + 1    Lines.Insert(mObj[1])    LineCnt := LineCnt + 1  }  WordCnt := 0  WordPattern := "\b\w+"  Loop, % LineCnt  {    Line := Lines[A_Index]    Start := 1    While (True)    {      FoundPos := RegExMatch(Line, WordPattern, mObj, Start)      If (ErrorLevel != 0)      {        OutputDebug, % "RegExMatch ErrorLevel (2nd call): " . ErrorLevel        SoundBeep        Return      }      If (FoundPos == 0)      {        Break      }      Start := FoundPos + 1      WordCnt := WordCnt + 1    }  }  MsgBox, % "Counted:`n`n"          . "  " . LineCnt . " line(s)`n`n"          . "  " . WordCnt . " word(s)"  Return}

rjbull:
4) Word count tool-jshare (December 21, 2011, 04:34 AM)
--- End quote ---

Character count is - sort of, I think - already built in.  You have to edit the columns you want shown, check the DataSize one, and make sure it shows up in the grid.  See screenshot.  I'm only guessing that DataSize equates directly to character count, though.  I can't see word count as such.  You could probably use an external program like unix `wc` as a Custom Script Tool, but that wouldn't give you an answer directly inside CHS.

jshare:
Below is an initial attempt at an LBA script to report line and word count for the current selection -- the result comes up as a dialog box so it doesn't match the request exactly.
-ewemoa (December 21, 2011, 08:15 AM)
--- End quote ---

Thanks for this. I tried it and I get "Error reading output file C:\Users\X\Documents\DonationCoder\Clipboard Help+Spell\tmpout.txt after tool run: C:\Program Files (x86)\Clipboard Help+Spell\Tools\word-count.ahk with params "C:\Users\X\Documents\DonationCoder\Clipboard Help+Spell\tmpin.txt" "C:\Users\X\Documents\DonationCoder\Clipboard Help+Spell\tmpout.txt""

ewemoa:
If you don't mind, would you provide more details on how you configured LBA and the steps you performed that resulted in the error?

jshare:
If you don't mind, would you provide more details on how you configured LBA and the steps you performed that resulted in the error?
-ewemoa (December 22, 2011, 03:26 AM)
--- End quote ---

Sorry, I had completely ignored the part about LBA. I thought that installing Autohotkey was enough. Now that LBA is setup, I added your script properly and it works. Although I would prefer a result in the Quick Paste Menu, this is definitely a big help already.

Thanks much!

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version