Problems registering, no confirmation email - see http://wiki.scribus.net/canvas/Forums_Registration
#!/usr/bin/env python
# File: count_words.py - Counts all words in a document
# also lists image files with pathnames
# 2006.03.04 Gregory Pittman
# 2008.02.28 Petr Vanek - fileDialog replaces valueDialog
# 2023.05.29 Michalis Demetriou - modify in order to just count all words
# this version 2023.05.29
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
import scribus
import re
def countWords():
page = 1
pagenum = scribus.pageCount()
T = []
content = []
while (page <= pagenum):
scribus.gotoPage(page)
d = scribus.getPageItems()
for item in d:
if (item[1] == 4):
contents = scribus.getAllText(item[0])
if (contents in content):
contents = ''
T.append(contents)
content.append(contents)
page += 1
text = " ".join(T)
text = re.sub('^ ','',re.sub(' $','',re.sub(' +', ' ', text)))
count = len(text.split(" "))
print(count)
endmessage = str(count) + ' words'
scribus.messageBox("Finished", endmessage,scribus.ICON_INFORMATION, scribus.BUTTON_OK)
if scribus.haveDoc():
try:
countWords()
except (Exception, e):
print(e)
else:
scribus.messageBox('Export Error', 'You need a Document open, and a frame selected.', \
icon=0, button1=1)
#!/usr/bin/env python
# File: count_words.py - Counts all words in a document
# also lists image files with pathnames
# 2006.03.04 Gregory Pittman
# 2008.02.28 Petr Vanek - fileDialog replaces valueDialog
# 2023.05.29 Michalis Demetriou - modify in order to just count all words
# this version 2023.05.29
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
import scribus
import re
def countWords():
page = 1
pagenum = scribus.pageCount()
T = []
content = []
while (page <= pagenum):
scribus.gotoPage(page)
d = scribus.getPageItems()
for item in d:
if (item[1] == 4):
contents = scribus.getAllText(item[0])
if (contents in content):
contents = ''
T.append(contents)
content.append(contents)
page += 1
# T.append('')
text = " ".join(T)
text = re.sub(' +', ' ', text)
count = len(text.split(" "))
print(count)
endmessage = str(count) + ' words'
scribus.messageBox("Finished", endmessage,scribus.ICON_INFORMATION, scribus.BUTTON_OK)
if scribus.haveDoc():
try:
countWords()
except (Exception, e):
print(e)
else:
scribus.messageBox('Export Error', 'You need a Document open, and a frame selected.', \
icon=0, button1=1)
Quote from: garydale on May 24, 2023, 05:56:37 PMI don't think so. The Adobe site suggests that a font can be any that is available "on your computer". The font chosen is embedded in the PDF file so any character should be able to be input.