• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Possible bug with AppScript and Excel?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Possible bug with AppScript and Excel?


  • Subject: Possible bug with AppScript and Excel?
  • From: Christian Prinoth <email@hidden>
  • Date: Fri, 30 Jul 2010 13:52:09 +0200

Well, leaving aside my personal preference for Python's syntaxis as opposed to Applescript's, I think that the major advantage of Python is the availability of numerous extensions, have a look at http://pypi.python.org/pypi

Applescript is fine for automating repetitive tasks, but I have not found satisfying solutions for more complex tasks.

In my case, I am using python to easily access data in a mysql database, read in XML and CSV files, then process all this data with R (which can be used as a Python extension giving it a wide range of statistical tools) and SciPy (a matlab-like scientific module), then I display everything on Excel for Mac (have done it with Numbers also, but the Applescript dictionary for Numbers is too limited) for a nice user friendly output.

Basically, python allows to easily handle complex data, doing (semi) serious programming stuff, and, thanks to appscript, also take advantage of all the Applescript goodiness provided on Os X.

And, python comes with every OsX installation, so it seems natural to me to use it.

Finally, Python is cross-platform (apart from the applescript specific stuff), so the investment of learning it is useful also in other contexts.

I could add many other reasons (availability of a real debugger, easy and clear syntaxis, powerful OO features etc.)


On Fri, Jul 30, 2010 at 13:18, Timothy Murphy <email@hidden> wrote:
Is there any particular advantage or benefits of using P+A over just Applescript that you could point out?

On 30 Jul 2010, at 10:11, Christian Prinoth wrote:

Thanks. In fact, I think that the problem I was experiencing is in fact due to AppScript (which is the python module allowing access to AppleScript dictionaries from Python), and I have solved it with the approach from my previous post.

BTW, I recommend Python+AppScript to every Applescript user, it opens a whole new world of possibilities ;)
In fact, I really hope that Apple one day makes Python an official OS X scripting language by allowing direct access to IPC tools from Python or by at least officially supporting AppScript.

On Fri, Jul 30, 2010 at 02:39, Timothy Murphy <email@hidden> wrote:
There is a difference in approach depending on whether you are creating, or addressing, a chart as an object in a worksheet, or as a chart sheet.
Charts embedded in a worksheet belong to the chart object class so, in general terms:
<some code...>
--::this creates the chart object itself
set oChartObj to make new chart object at end ¬
with properties{ whatever..}
--::address the chart element of the object
tell chart of oChartObj
set chart type to line chart
set newSeries to make new series at end ¬
with properties {series values:¬
(-insert reference-), xvalues:¬
(-insert reference-), name:¬
(-insert reference-)}
--::still addressing  the chart element of the object, we now address its category axis, or x axis
set categoryAxis to get axis axis type category axis ¬
which axis primary axis
tell categoryAxis
--set has title to true
set has title to false
set crosses at to maximum scale
end tell
--::still addressing  the chart element of the object, we now address its value axis, or y axis
set valueAxis to get axis axis type value axis ¬
which axis primary axis
tell valueAxis
set major unit is auto to true
set major tick mark to tick mark none --options are:¬
--tick mark cross / tick mark inside / tick mark none / tick mark outside
set minor tick mark to tick mark none
set tick label position to tick label position high --places value labels (ie. the scale) outside the chart
(*options are: tick label position high/tick label position low/tick label position next to axis/tick label position none*)
set maximum scale to 1
set minimum scale to 0
set has title to false
end tell
--::End Tell -- (telling chart of oChartObj)

If you are telling a chart sheet, there is a difference:
set myChart to (make new chart sheet at end of active workbook with properties {name:.....})

tell active chart
--::this line gets the data for a series
make its series with properties {series values:-insert ref-, xvalues:-insert ref-, name:-insert ref-}

set size with window to true
--set chart type to line chart
set chart type to xy scatter smooth 
set the_x_Axis to (get axis axis type category axis ¬
which axis primary axis)
tell the_x_Axis
set major unit is auto to false  --etc.etc.
end tell
end tell

I hope this answers your question regarding Excel. 
Regarding Python...nfc, sorry.





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Possible bug with AppScript and Excel?
      • From: Tommy Bollman <email@hidden>
    • Re: Possible bug with AppScript and Excel?
      • From: Philip Aker <email@hidden>
References: 
 >Re:Possible bug with AppScript and Excel? (From: Timothy Murphy <email@hidden>)

  • Prev by Date: Possible bug with AppScript and Excel?
  • Next by Date: Remote Script Server
  • Previous by thread: Possible bug with AppScript and Excel?
  • Next by thread: Re: Possible bug with AppScript and Excel?
  • Index(es):
    • Date
    • Thread