[Pythonmac-SIG] appscript and Office 2011, not working?

Christian Prinoth christian at prinoth.name
Thu Feb 17 11:41:31 CET 2011


Has,
 thanks for your reply. I have tried doing what you suggest. the four char
code for the range object is X117, so I did the following:

app('Microsoft
Excel').AS_newreference(aem.app.elements('X117'))['A1'].value()

and this works fine in both Excel 2008 and Excel 2011. My problem is that
this way I can only reference a range in the currently active worksheet.
Using standard appscript syntax I would do the following:

app('Microsoft Excel').worksheets['Sheet1'].ranges['A1'].value()

to access data on a specific cell on a specific worksheet. How do I do that
with the AEM syntax you suggested?

I tried something along the lines of:

ws.AS_newreference(aem.app.elements('X117'))[address]

which won't work since a reference to a worksheet object does not have
the AS_newreference method. Tried playing a bit with AS_aemreference but I
am not getting how this is supposed to work.

Thanks
Christian



> Wild guess: Excel's dictionary defines both a 'ranges' property and a
> 'range' class (plural 'ranges'). AppleScript can just about deal with
> that sort of ambiguity as the compiler can determine from context if a
> 'ranges' keyword is being used as a property name or element name.
> Appscript doesn't have that luxury, so has to favour one
> interpretation or the other; in this case, the former. If you need it
> to go the other way, you'll need to drop down to the aem API
> (equivalent to using chevron syntax in AS); something like:
>
> app('Microsoft
> Excel').AS_newreference(aem.app.elements('xxxx'))['B2'].value()
>
> You'll need to use ASDictionary to export the Excel dictionary as
> plain text in order to look up the correct four-char code to use in
> the aem reference.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20110217/aab18465/attachment-0001.html>


More information about the Pythonmac-SIG mailing list