[Pythonmac-SIG] appscript -- Getting 1708 Error on count command for word 2008

Travis Caldwell travis_caldwell2000 at yahoo.com
Sat Aug 16 05:20:32 CEST 2008


 Not sure if this is user error or a bug, but I can't seem to send the count command to Word 2008 via appscript.

>>> word.documents.count()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.5/site-packages/appscript-0.18.1-py2.5-macosx-10.5-i386.egg/appscript/reference.py", line 439, in __call__
appscript.reference.CommandError: CommandError -1708: Application could not handle this command.
	Failed command: app(u'/Applications/Microsoft Office 2008/Microsoft Word.app').documents.count()

I can call help on the count command via the same path so I think I'm calling count() from the right place:

>>> word.documents.count.help()
==============================================================================
Help (-t)

Reference: app(u'/Applications/Microsoft Office 2008/Microsoft Word.app').documents.count

------------------------------------------------------------------------------
Description of reference

Terminology for count command
[...]

And Word seems to support the count command since this works from the script editor:

tell application "Microsoft Word"
	display dialog (get count of documents)
end tell


And finally, I tried doing a count with TextEdit and that seems to work fine:

>>> te = app('TextEdit')
>>> te.activate()
>>> te.documents.count()
3


Any help would be appreciated.

             _Travis_Caldwell_


      



More information about the Pythonmac-SIG mailing list