[Pythonmac-SIG] Modifying table cell content with python-appscript
has
hengist.podd at virgin.net
Sat Nov 22 12:03:24 CET 2008
On 22 Nov 2008, at 10:10, Sven A. Schmidt wrote:
>> - 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)
Any idea where the 'unnamed customer' is coming from? Is the appscript
'set' command setting the text field's value? Can you post both your
working AppleScript and non-working Python script for comparison?
Also, if you can run your application with AEDebug enabled:
export AEDebugSends=1; export AEDebugReceives=1; open /path/to/
YourApp.app
run the AppleScript and the Python script, and post the raw Apple
event logs from Console, that'll let me check for any differences
between the events they're sending that might explain it.
> BTW, your code "app('AppName').windows['Untitled']" fails with
>
> AttributeError: Unknown property, element or command: 'windows'
Durr, my bad. Yes, you're right, should've been
sysevents.processes['YourApp'].windows....
has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net
More information about the Pythonmac-SIG
mailing list