[kde-linux] Counting words in Kate

Gianluca Varisco giangy at gxware.org
Tue Apr 11 10:27:09 UTC 2006


Andrew Walbran wrote:

> One possibility:
> 
> Go Settings->Configure Kate->Application->External tools.
> Click New..., enter 'Count selected words' for the title and the following for 
> script:
> 
> COUNT=$(echo "%selection" | wc -w)
> kdialog --title "Word count" --msgbox "$COUNT words are selected."
> 
> Choose an icon if you like, then press OK twice.
> Now you can use Tools->External Tools->Count selected words on the menu.
> 

Well,

I think that this possibility is the best one. Paulo, you can see 
http://www.kde-apps.org/content/show.php?content=13604 and 
http://www.kde.nl/doc/kate-scripting/ for more informations. The first 
link is an example like Andrew's script:

doc=`dcop $1 KateDocumentManager activeDocumentNumber`
dcop $1 EditInterface#$doc text | wc | {
         read lines words chars
         kdialog --title "Word count" \
                 --msgbox "<qt><table>
                 <tr><td>Lines:</td><td align=right><b>$lines</b></td></tr>
                 <tr><td>Words:</td><td align=right><b>$words</b></td></tr>
                 <tr><td>Characters:</td><td 
align=right><b>$chars</b></td></tr>
                 </table></qt>"


Best Regards,

Gianluca Varisco

-- 
GxWare.org Research Lab
http://www.gxware.org - giangy at gxware.org



More information about the kde-linux mailing list