472,362 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,362 software developers and data experts.

Win32 COM

I don't know anything about COM beyond the fact that I can look in the
OLE/COM browser to maybe figure out the API that an object has that I
need to operate on. Usually this gets me by fine; I've written mostly
utilities for Developer Studio which work fine if a little slow, and a
bit of junk for some other bits of the MS Office suite. However, now
I'm a bit stuck.

I've got this object, and the documentation and sample code imply that
I can just call this method I need to call on it, and ding-dong. It's
for creating a "command" object to pass to the application, and it
works (or rather, is supposed to work) sorta like this:

operation = win32com.client.Dispatch('AppHelper.AppParameter')
operation.Command = 'A_Command_Name'
operation.SetParameter('param1', 'value')

However, I get an attribute error on the SetParameter call, which
indicates that it doesn't exist.

So, I look at the object browser, and sure enough it isn't there.
However, there is a 'Parameter' method. Oh wait, there are two.
There's one that takes the parameter name and (presumably) returns the
value, and there's another that takes the parameter name and the value
that it's set to.

Through fiddling with this thing in IPython, I found that I can do:


....which throws an exception, but once that's been run, I can do what
I set out to do:

operation.SetParameter('param1', 'value')

....and all is well.

Can anyone give me any tips as to what's going on here and what I
might be doing wrong? I have /not/ run the makepy.py or whatever it
is, since when I roll this out to the team I don't want to have to run
that on every machine before it'll work, but if that's what I need to
do, well, so be it. However, at this time I'm stumped as to what to
try except that I can have a dirty-feeling try/except bit to "enable"
that call...

Nov 2 '06 #1
1 1427
Tom Plunket wrote:
I don't know anything about COM beyond the fact that I can look in the
OLE/COM browser to maybe figure out the API that an object has that I
need to operate on.
I'm still not entirely sure what's going on, because there are some
methods and properties that are available before doing this, but
makepy was part of my solution.

What I wanted to avoid was explicitly going around and running makepy
N times on everyone's machine that might need to run this toolset.
What I discovered I could do was run makepy with a -i command-line
parameter, which would emit code that would kick the gencache to
implicitly run makepy if necessary. So, problem solved!

in my case:

: C:\Python24\Lib\site-packages\win32com\client>makepy -i
: NxNXMLHelper 1.0 Type Library
: {5E7B0F01-92C1-11D3-A5FB-00104B45886F}, lcid=0, major=1, minor=0
: >># Use these commands in Python code to auto generate .py support
: >>from win32com.client import gencache
: >>gencache.EnsureModule('{5E7B0F01-92C1-11D3-A5FB-00104B45886F}', 0, 1, 0)

Very handy!
Nov 2 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: RL | last post by:
Hi all, I am new and am lost with Win32::Process stuff. I want on perl script to start a process, then another perl script to terminate the same process. I can start a process using......
by: RL | last post by:
Hello Perl gurus, 1. I have a web page where I can push a button (dospawn.html). 2. This button calls a CGI script (spawnboss.cgi) 3. spawnboss.cgi calls a forking perl script (forkme.pl) 4....
by: Bryan Parkoff | last post by:
Please provide me the information when it is not in the correct newsgroups. I have been using C and C++ language for a long time when it is time for me to learn Win32 API functions that they can...
by: Tony Johansson | last post by:
Hello!! When you for example use C++.net environment for develop an GUI application does this mean that you doesn't use win32 API as much as when you had visual studio 6.0 because of the large...
by: Tony Johansson | last post by:
Hello! I just wonder what the difference is between a native win32-app and MFC. What I know is that you can use Win32 API in both cases. I think an MFC application is connected with a GUI...
by: Gil | last post by:
I need to create a web page in which its content should be controlled by some win32 application. this application may add or remove some gif images from the page and it should be smooth as possible...
by: =?Utf-8?B?Q29saXZpZXI=?= | last post by:
If anyone can help me with this I would really appreciate it: I have an assembly into which I have linked a manifest file as a Win32 resource. This is necessary since I want to use a class in this...
by: jbenezech | last post by:
Hi all , I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform...
by: somuchh8 | last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this: my $success = undef; my $cmdline =...
by: Perl Beginner | last post by:
Good morning all, I had to reinstall Perl (ActivePerl 5.10.0 Build 1004) on my computer (Windows XP), the install went fine. however, I'm having issues loading Win32-GuiTest using the repository in...
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.