Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I need a wordcount in Kate on my newly-installed Kubuntu, and I found one at wiki.kate-editor.org. It consists of two files in .kde/share/apps/kate/scripts:
#!/bin/bash
case "$1" in kate*) ;;
*) echo "Please call me from Kate" > &2 exit 1;;
esac
doc=`dcop $1 KateDocumentManager activeDocumentNumber`
dcop $1 editinterface#$doc text | wc | { \
read lines words chars kdialog -- title "Word Count" \
--msgbox "<qt><table> <tr><td>Total Lines:</td>
<td align=right><b>$lines</b></td></tr>
<tr><td>Total Words:</td><td
align=right><b>$words</b></td></tr>
<tr><td>Total Chars:</td><td
align=right><b>$chars</b></td></tr>
</table></qt>"
}
Kate evidently finds the wordcount.desktop, as the KDE scripts list on the Tools menu shows whatever I put in the Name field, but if I click it I get:
unable to find script "&Word Count"
As the other entries in the KDE scripts list do the same thing I assume either there is a config problem or the function is broken. The manual is no help at all. Anyone out there know how to fix this? I tried giving the full path for wordcount.sh but still nothing.
However, I went to the Kate project page and voted for a wordcount on the wishlist, and this, which works for me on FC4 KDE (I have given up on Kubuntu as it will not work with my DVD burner), was posted in reply:
QUOTE]
Meanwhile, kates 'external tools' feature provides you with a easy way to do this. Here is a very simple implementation, note though that this does not work with non-local files, and that it saves the document if it has changes. The next version (3.0) of kate will allow to pipe text into commands used for external tools. But adding the following to $KDEHOME/share/apps/kate/externaltools would provide you with a command "Tools->External tools->Word count" that will work with local files:�
echo $KDEHOME came up with nothing, but I found externaltools in /usr/share/apps/kate or ~/.kde/share/apps/kate
Be sure to add ", externaltool_Wordcount" to the global list at the top.
Note you can also add a shortcut for it, I used Shift+F12 which seems to work.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.