Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Problems automating Sigmaplot via COM

Reply
Thread Tools

Problems automating Sigmaplot via COM

 
 
Axel Kowald
Guest
Posts: n/a
 
      07-27-2003
Hi everybody,

I try to use python2.2 to automate Sigmaplot 8 via the COM interface.
I can fill data into a worksheet, but have problems to create a graph

When I use the CreateGraphWizard method I always get the error
message:

"com_error: (-2147352567, 'Exception occurred.', (65535, 'SigmaPlot
8.0', 'Invalid error bar source argument.', None, 0, 0), None)"

However, the type of graph I'm trying to create doesn't have error
bars!

Any idea what's going wrong?

Many thanks,

Axel Kowald



================================================== ===================
#!/usr/bin/env python
#
# Simple example how to create a Sigmaplot diagram automatically.
# 7.2003 A.Kowald
#
from win32com.client import Dispatch

app = Dispatch("SigmaPlot.Application")
app.Width = 800 # desired width & height of main window
app.Height = 600
app.Visible = True
# create notebook and automatically one section with worksheet
app.Notebooks.Add

# the NotebookItems of the "ActiveDocument" (Notebook) have now 3
items:
print app.ActiveDocument.NotebookItems.Count
# Item 0 (ItemType 7) = The notebook itself
# Item 1 (ItemType 3) = Section 1
# Item 2 (ItemType 1) = Data 1 in Section 1
# Lets name them, so we can refer to them by name.
app.ActiveDocument.NotebookItems(0).Name = "MyBook"
app.ActiveDocument.NotebookItems(1).Name = "MySection"
app.ActiveDocument.NotebookItems(2).Name = "MyData"
app.ActiveDocument.NotebookItems.Add(2) # Add graphic
page
app.ActiveDocument.NotebookItems(3).Name = "MyGraph"
dataTab = app.ActiveDocument.NotebookItems("MyData").DataTab le

# 3 methods are available for data manipulation:
# Cell(x,y,value) 0 based
# PutData(1D/2Darray, left,top)
# 1D/2Darray = GetData(left,top,right,bottom)
dataTab.Cell(0,0,17) # puts 17 in the top left corner
d = [[1,2,3],[2,4,6]] # col1 = 1,2,3 col2 = 2,4,6
dataTab.PutData(d,0,0)
rect = dataTab.GetData(0,0,2,2) # Get 3x3 tuple

# Adding column names (name,left,top,width,height=-1)
dataTab.NamedRanges.Add('X',0,0,1,-1)
dataTab.NamedRanges.Add('Y',1,0,1,-1)

# Now lets plot the data
graphPage = app.ActiveDocument.NotebookItems("MyGraph")
graphPage.CreateWizardGraph("Vertical Bar Chart","Simple Bar","XY
Pair",[0,1])

#app.Quit # stop COM server
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems automating inVBA Cliff ASP .Net 4 03-14-2008 12:03 PM
Automating a password reset via net-telnet Daniel Berger Ruby 1 07-10-2007 09:16 PM
automating logon to passwd protected urls ? ngoc Firefox 0 09-29-2005 02:18 PM
Automating WPA-PSK installation on domain PCs? =?Utf-8?B?RHJCdW5zZW4=?= Wireless Networking 3 08-01-2005 09:09 PM
Automating Cisco switch configuration changes Dmitry Cisco 4 02-10-2004 08:50 AM



Advertisments