On 29 Jul 2010, at 15:43, Christian Prinoth wrote:
> Hi, I am having some problems handling axes in Excel charts via python and
> appscript.
>
> I am using apple's stock python 2.6.1, appscript 0.21.1 and Excel 12.2.5 on
> Snow Leopard 10.6.4
>
> Here is how I am trying to get hold of an axis:
>
> *c=app('Microsoft
> Excel').get_axis(app.active_sheet.chart_objects[1].chart,axis_type=k.value_axis)
> *
>
>
> now c contains
>
> *app(u'/Applications/Microsoft Office 2008/Microsoft
> Excel.app').active_sheet.chart_objects[1].
chart.axes.ID(131073)*
>
>
> but if I do:
>
> *c2=app('Microsoft Excel').get_axis(app.active_chart,axis_type=k.value_axis)
> *
>
>
> apparently I get the same result, in fact c==c2 returns true. Yet, if I try
> to access c, I get an error, eg
>
> *In [16]: c.maximum_scale()*
> *------------------------------------------------------------*
> *Traceback (most recent call last):*
> * File "<ipython console>", line 1, in <module>*
> * File "build/bdist.macosx-10.6-universal/egg/appscript/reference.py", line
> 643, in __call__*
> * return self.get(*args, **kargs)*
> * File "build/bdist.macosx-10.6-universal/egg/appscript/reference.py", line
> 499, in __call__*
> * raise CommandError(self, (args, kargs), e, self.AS_appdata)*
> *CommandError: Command failed:*
> * *
> *OSERROR: -1728*
> * *
> *MESSAGE: The object you are trying to access does not exist*
> * *
> *COMMAND: app(u'/Applications/Microsoft Office 2008/Microsoft
> Excel.app').active_sheet.chart_objects[1].
chart.axes.ID(131073).