[Pythonmac-SIG] Modifying table cell content with python-appscript

has hengist.podd at virgin.net
Fri Nov 21 19:27:07 CET 2008


Sven A. Schmidt wrote:

> I hope I'm in the correct place with this problem -- I've found this  
> list through a link from the python-appscript page. My problem  
> probably falls between python and AppleScript but I've not been able  
> to find any clues on the web or in this list's archives. Please let  
> me know if there's a better place for me to post this!

Application-specific questions (e.g. "how do I create and send an  
email in Mail?") may be directed here and/or to applescript-users;  
wherever you think's appropriate. Questions on py-appscript itself are  
best directed here, since those are primarily related to Python.


> I'm trying to script a Cocoa app I wrote to establish user level  
> tests. To that end I'm trying to populate a table view (backed by  
> Core Data) with entries. Thanks to Prefab's UI Browser I've had  
> little trouble identifying and accessing the UI controls from py- 
> appscript. However, progress has ground to a halt when I tried to  
> change a value in a table view cell. The code is the following:
> [...]


Should work, although hard to say why it isn't without some more  
detail. A couple pointers:

- If you're on Python 2.6, make sure you're using py-appscript 0.19.0  
(which includes a workaround for a known problem in Python 2.6's  
UTF-16 codec). You can either grab it from the svn trunk or wait a few  
days for the official file release.

- If you're on 2.5 or earlier, post the complete appscript code you're  
using to set the text field's value and the Python value you get when  
you get it so we can take a look, e.g. something like:

     ref = app('AppName').windows['Untitled'].splitter_groups[1] \
             .scroll_areas[3].tables[1].rows[1].text_fields[1]

     s = '<string>'
     ref.value.set(s)
     t = ref.value()
     print (s, t, s == t)
     # Result: ...

HTH

has
-- 
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



More information about the Pythonmac-SIG mailing list