473,387 Members | 1,724 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,387 software developers and data experts.

Explorer Shell extensions are here!

I just happened to bump into this today when I went to the Win32
Python Extensions page. I think the M.H. and his team are a bit too
modest.

Quote:
"win32com.shell grows many more interfaces, allowing Python to operate
as a nearly complete shell extension, and to interact with the shell
interfaces. See the win32comext\shell\demos\server directory for
examples."

This is something I had been waiting for a while, and even submited a
"feature request" about it. So, since I hadn't heard any thing about
it, I figure there may be a few more like me that would enjoy knowing
about this.

(Now, if I could only figure out how to make a context menu that would
show up for any file of folder... ;)

-Ruben
Jul 18 '05 #1
4 3235
R.Marquez wrote:
I just happened to bump into this today when I went to the Win32
Python Extensions page. I think the M.H. and his team are a bit too
modest.

Quote:
"win32com.shell grows many more interfaces, allowing Python to operate
as a nearly complete shell extension, and to interact with the shell
interfaces. See the win32comext\shell\demos\server directory for
examples."

This is something I had been waiting for a while, and even submited a
"feature request" about it. So, since I hadn't heard any thing about
it, I figure there may be a few more like me that would enjoy knowing
about this.
I _do_ enjoy knowing about this ;>) Thanks for the tip.
(Now, if I could only figure out how to make a context menu that would
show up for any file of folder... ;)


In the demo "context_menu.py", replace the register and unregister bits
with the code below. Run context_menu.py with either the --register or
--unregister switch, as appropiate.

def DllRegisterServer():
import _winreg
folder_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
"Folder\\shellex")
folder_subkey = _winreg.CreateKey(folder_key, "ContextMenuHandlers")
folder_subkey2 = _winreg.CreateKey(folder_subkey, "PythonSample")
_winreg.SetValueEx(folder_subkey2, None, 0, _winreg.REG_SZ,
ShellExtension._reg_clsid_)

file_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
"*\\shellex")
file_subkey = _winreg.CreateKey(file_key, "ContextMenuHandlers")
file_subkey2 = _winreg.CreateKey(file_subkey, "PythonSample")
_winreg.SetValueEx(file_subkey2, None, 0, _winreg.REG_SZ,
ShellExtension._reg_clsid_)

print ShellExtension._reg_desc_, "registration complete."

def DllUnregisterServer():
import _winreg
try:
folder_key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,

"Folder\\shellex\\ContextMenuHandlers\\PythonSampl e")
file_key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,

"*\\shellex\\ContextMenuHandlers\\PythonSample ")
except WindowsError, details:
import errno
if details.errno != errno.ENOENT:
raise
print ShellExtension._reg_desc_, "unregistration complete."

Peace,
Joe
Jul 18 '05 #2
ny**********@yahoo.com (R.Marquez) writes:
[...]
(Now, if I could only figure out how to make a context menu that would
show up for any file of folder... ;)


You can do shell extension stuff quite easily with ctypes, too.
There's a good O'Reilly book on the subject (based on VB, but that
doesn't matter). Use the CVS version, not the tarball, there's at
least one important COM bug fixed there.

One tip: some common COM interfaces don't have type libraries, but
it's easy to write your own interface specifications for ctypes, just
by following the very readable output of the ctypes script (equivalent
of gen_py in win32com) that usually does this job for you.
John
Jul 18 '05 #3
Great! That is just what I needed. Thank you, M.H. and all other
Pythonistas for all your great work and generous spirit.

-Ruben

Joe Francia <us****@soraia.com> wrote in message news:<k8*********************@news.easynews.com>.. .
R.Marquez wrote:
I just happened to bump into this today when I went to the Win32
Python Extensions page. I think the M.H. and his team are a bit too
modest.

Quote:
"win32com.shell grows many more interfaces, allowing Python to operate
as a nearly complete shell extension, and to interact with the shell
interfaces. See the win32comext\shell\demos\server directory for
examples."

This is something I had been waiting for a while, and even submited a
"feature request" about it. So, since I hadn't heard any thing about
it, I figure there may be a few more like me that would enjoy knowing
about this.


I _do_ enjoy knowing about this ;>) Thanks for the tip.
(Now, if I could only figure out how to make a context menu that would
show up for any file of folder... ;)


In the demo "context_menu.py", replace the register and unregister bits
with the code below. Run context_menu.py with either the --register or
--unregister switch, as appropiate.

def DllRegisterServer():
import _winreg
folder_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
"Folder\\shellex")
folder_subkey = _winreg.CreateKey(folder_key, "ContextMenuHandlers")
folder_subkey2 = _winreg.CreateKey(folder_subkey, "PythonSample")
_winreg.SetValueEx(folder_subkey2, None, 0, _winreg.REG_SZ,
ShellExtension._reg_clsid_)

file_key = _winreg.CreateKey(_winreg.HKEY_CLASSES_ROOT,
"*\\shellex")
file_subkey = _winreg.CreateKey(file_key, "ContextMenuHandlers")
file_subkey2 = _winreg.CreateKey(file_subkey, "PythonSample")
_winreg.SetValueEx(file_subkey2, None, 0, _winreg.REG_SZ,
ShellExtension._reg_clsid_)

print ShellExtension._reg_desc_, "registration complete."

def DllUnregisterServer():
import _winreg
try:
folder_key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,

"Folder\\shellex\\ContextMenuHandlers\\PythonSampl e")
file_key = _winreg.DeleteKey(_winreg.HKEY_CLASSES_ROOT,

"*\\shellex\\ContextMenuHandlers\\PythonSample ")
except WindowsError, details:
import errno
if details.errno != errno.ENOENT:
raise
print ShellExtension._reg_desc_, "unregistration complete."

Peace,
Joe

Jul 18 '05 #4
jj*@pobox.com (John J. Lee) wrote in message news:<87************@pobox.com>...
ny**********@yahoo.com (R.Marquez) writes: You can do shell extension stuff quite easily with ctypes, too.
There's a good O'Reilly book on the subject (based on VB, but that
doesn't matter). Use the CVS version, not the tarball, there's at
least one important COM bug fixed there.

One tip: some common COM interfaces don't have type libraries, but
it's easy to write your own interface specifications for ctypes, just
by following the very readable output of the ctypes script (equivalent
of gen_py in win32com) that usually does this job for you.


John,

I appreciate the tip. I'll have to take a deeper look at ctypes as well.

-Ruben
Jul 18 '05 #5

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

Similar topics

1
by: vighnesh | last post by:
Hi All I am presently working in a project(VB.NET/C#.NET) in which I have to add a custom toolbar to the "Internet Explorer". Can anyone please help me in this regard?Thank you in advance. ...
3
by: svd | last post by:
I would like to: 1) Add a button to the IE toolbar 2) When presses, it get's the current URL 3) If my application is not running, starts it 4) Finds my application is the list of running...
5
by: gjuro kladaric | last post by:
it was not possible to make a shell extension from within VB2003, I believe has anything changed since then, can I (easily) write a VB code that would function as a shell extension thank you ...
2
by: Martin Carpella | last post by:
Hi! Can anybody give me a pointer if/how I could retrieve the Explorer context menu of a given file in C#? Thanks in advance, Martin
3
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
I am using VS2003 to create a C# dll that uses shell namespace extensions. I need to debug my code but it is running in the explorer.exe process and when I open my namespace extension from My...
3
by: Shafiq | last post by:
Hi, I am trying to insert a new toolbar button to the windows explorer menu. I an able to locate the correct ToolbarWindow32, and inserted a button using the code snippet shown below. However...
2
by: Jeff Gaines | last post by:
I am in the process of upgrading to XP 64. VS2008 is running fine but one of my apps, which adds functionality to the Explorer context menu, just won't work under XP 64. Googling resulted in my...
0
by: sony.m.2007 | last post by:
Hi, I'm trying to add a contextmenu(adding my custom context menu) to windows explorer. This context menu has to be shown for all files and folder Th new context menu will be like this ...
5
by: AGP | last post by:
I have been looking far and wide for an easy to implement shell extension. My needs are basic...for two file extensions .YYY and .ZZZ I would like the context menu in explorer to simply show my app...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.