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

Sven A. Schmidt sas at abstracture.de
Sat Nov 22 11:10:55 CET 2008


has, thanks a lot for your reply!
> Should work, although hard to say why it isn't without some more 
> detail. A couple pointers:

Right, after years of replying to bug reports with "what version are 
you using" I forget to include version info... I'm using python 2.5 
and appscript 0.18.1, both from fink:
 i appscript-py25 0.18.1-1 High level Apple event bridge 
for Python
 i python25 1:2.5.2-1 Interpreted, object-oriented 
language
> - 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: ...

Ok, I've tried your example:
	sysevents = app('System Events')
	hg = sysevents.processes['Hourglass']
	ref = hg.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)
Here's what I get:
[eris:sas/Hourglass-trunk/Tests] sas% python2.5 hg_test.py
('<string>', u'unnamed customer', False)
BTW, your code "app('AppName').windows['Untitled']" fails with
	AttributeError: Unknown property, element or command: 'windows'
and I have to use the process from sysevents. I suppose this is 
because my app is not scriptable and I'm using UI scripting? Is that 
essentially the difference between app('xxx') and 
sysevents.processes['xxx']? (I guess this has nothing to do with my 
actual problem, I'm just curious.)
Cheers,
Sven


More information about the Pythonmac-SIG mailing list

AltStyle によって変換されたページ (->オリジナル) /