| View previous topic :: View next topic |
| Author |
Message |
fortydeuce General User

Joined: 10 Dec 2006 Posts: 6
|
Posted: Sun Dec 10, 2006 1:42 pm Post subject: Can anyone change a macro into an add-on? |
|
|
I found this macro for Python:
http://yawar.blogspot.com/2006/05/live-word-count-script-for.html
... but cannot for the life of me get it to change into a macro. So I'm wondering if there's anyone out there that knows scripting well enough and thinks it would be quick enough to turn this into a proper add-on. I know no scripting languages whatsoever, have spent the past two hours trying (and failing!) to get it to take. All I want is a live word count! Thanks in advance.
Alternately, if anyone knows any OTHER live word counts (esp. one that automatically updates in the status bar) for openoffice, that would be just as good. Thanks again. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Sun Dec 10, 2006 3:03 pm Post subject: |
|
|
Save the code in a plain text file in your userdirectory:
In Linux it is ~/.openoffice.org2/user/Script/python/wordcount.py
Directory python is not there by default, so add it. The .py suffix is important.
Then browse Tools>options>macros>My Macros
There should be "wordcount" as a library with "wordCount" as callable routine. Call it. If it works, you may want to assign a shortcut, menu-entry or button.
For more stuff like that search this forum and the code snippets for word count using the "Search" link above. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
fortydeuce General User

Joined: 10 Dec 2006 Posts: 6
|
Posted: Sun Dec 10, 2006 4:11 pm Post subject: |
|
|
What you describe is exactly what I've done (in windows, putting it under c:/documents and settings/<user>/application data/openofficeorg.2/user/scripts/python after saving it in notepad as wordcount.py.)
When I go into tools>options>macros>My Macros, I receive the library, but no callable routine.
I am running Windows XP Pro and OOo 2.04 - just checked today for updates before trying to install this, and I'm up to date.
ETA: I'm browsing into a different menu: tools>macros. tools>options has no macros sublibrary/tab/index/whatever. |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Mon Dec 11, 2006 4:02 am Post subject: |
|
|
| fortydeuce wrote: | | What you describe is exactly what I've done (in windows, putting it under c:/documents and settings/<user>/application data/openofficeorg.2/user/scripts/python after saving it in notepad as wordcount.py.) |
Python scripts in OpenOffice.org must have Unix-style line ends. Use an editor which can create such text files. |
|
| Back to top |
|
 |
|