Create/Edit Win32 Shortcuts?
Gerhard Häring
gerhard.nospam at bigfoot.de
Thu Apr 19 22:51:06 EDT 2001
Don Tuttle wrote:
>
> [Don Tuttle]
> > >
> > > I can't believe that Python doesn't have the ability to create/edit
> > > Win32 shortcuts (.lnk files). But after an hour of searching the
> > > archives and my books I can't find anything at all. Would someone
> > > point me in the right direction?
[...]
> Sorry for the slow reply. I'd love to see your code! Even better, I'd love
> to see you polish it and then submit it for inclusion in the core Windows
> distribution. Shortcuts are so ubiquitous in Windows that a simple way to
> work with them really should be a part of the OS module. I suspect the lack
> of demand for this feature is simply the respective lack of NT admins
> currently using Python. I'm also expecting this to change dramatically over
> the next few years. (I was doing remote admin work via telnet when I posted
> my question.)
I'll think about polishing it, but for now I have only had a quick
glance over it and put some comments here and there. You can download it
here (source and binary prebuilt for Python 2.1):
http://home.t-online.de/home/err666/VitaminP/index.html
You can use it like this:
import WinSetupUtil
shortcut = WinSetupUtil.Shortcut()
shortcut.setShortcutName( "c:/tmp/TestShortcut.lnk" )
shortcut.setLinkSource( "c:/WINNT/Notepad.exe" )
shortcut.setIconFileName( "c:/WINNT/Explorer.exe" )
shortcut.setIconNumber( 0 )
shortcut.save()
Gerhard
PS: I really don't think it belongs in the library's os module. A
separate module like _winshortcut would perhaps have a chance to get in,
like the _winreg we already have.
--
Sorry for the fake email, please use the real one below to reply.
contact: g e r h a r d @ b i g f o o t . d e
web: http://highqualdev.com
More information about the Python-list
mailing list