Self updating word count

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
daveyfuggles
Posts: 9
Joined: Tue Jun 10, 2008 11:35 am

Self updating word count

Post by daveyfuggles »

HI
is it possible to insert a word count field in the document that will update itself as I type?

many thanks indeed

Dave
OOo 2.4.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Self updating word count

Post by Villeroy »

See this ready-to-use Python script: http://yawar.blogspot.com/2006/05/live- ... t-for.html
Copy with UNIX line feeds to directory <OOo_user_profile>/user/Script/python/
It uses a modeless (floating) dialog.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
daveyfuggles
Posts: 9
Joined: Tue Jun 10, 2008 11:35 am

Re: Self updating word count

Post by daveyfuggles »

Hi
Thanks for this but I don't understand what you mean by "Copy with UNIX line feeds". Do I use Notepad or something to create a file?

Dave

Villeroy wrote:See this ready-to-use Python script: http://yawar.blogspot.com/2006/05/live- ... t-for.html
Copy with UNIX line feeds to directory <OOo_user_profile>/user/Script/python/
It uses a modeless (floating) dialog.
OOo 2.4.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Self updating word count

Post by Villeroy »

Any decent plain-text editor can do this (no, Notepad can't). Mac, Linux (UNIX) and Windows use different codes for new lines. Python macros need to be stored with UNIX line feeds.
Edit: I just noticed that Writer can do.
File>SaveAs..., type: Text encoded
[ ] Automatic file name extension (add .py by yourself)
[X] Edit filter settings
Next dialog: Paragraph Break = LF
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply