473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 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:

operation.Parameter('foo')

....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...

thx,
-tom!
Nov 2 '06 #1
1 1474
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!
-tom!
Nov 2 '06 #2

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

Similar topics

1
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......
2
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....
5
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...
2
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...
8
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...
3
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...
0
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...
0
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...
3
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 =...
6
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.