We use win32com for our shortcut creation as well.
One thin I noticed that is different in you code compared to ours is
that we pass true as the second parameter to persist_file.Save

To be more helpful I think we would need to know where your code is
dying, and what error messages you are getting.

-----Original Message-----
From: Markus Gritsch [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 03, 2008 9:11 AM
To: comtypes-users@lists.sourceforge.net
Subject: [comtypes-users] Creating Shell Links using comtypes

Hi,

I would like to create shell links (.lnk) from my Python program.  I
found the following solution at [1] which uses win32com:

import os, sys
import pythoncom
from win32com.shell import shell, shellcon

shortcut = pythoncom.CoCreateInstance (
  shell.CLSID_ShellLink,
  None,
  pythoncom.CLSCTX_INPROC_SERVER,
  shell.IID_IShellLink
)
shortcut.SetPath (sys.executable)
shortcut.SetDescription ("Python %s" % sys.version)
shortcut.SetIconLocation (sys.executable, 0)

desktop_path = shell.SHGetFolderPath (0, shellcon.CSIDL_DESKTOP, 0, 0)
persist_file = shortcut.QueryInterface (pythoncom.IID_IPersistFile)
persist_file.Save (os.path.join (desktop_path, "python.lnk"), 0)

I was trying to translate this to comtypes, but had absolutely no
success.  It would be very nice, if someone could give me any advice
how to do this using comtypes.

Kind regards,
Markus

[1]
http://tgolden.sc.sabren.com/python/win32_how_do_i/create-a-shortcut.htm
l

------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
comtypes-users mailing list
comtypes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/comtypes-users

Reply via email to