I'm still getting my feet wet on the Windows side of things with Python, so I apologize for the noobish question.
If i am reading the create_link.py example correctly, that is created when the application itself is invoked, not during installation. Is that correct? If it is, how would I be able to invoke that when generating the MSI so that the installer creates the shortcut? Cesar On Thu, Apr 5, 2012 at 8:42 PM, Mark Hammond <skippy.hamm...@gmail.com>wrote: > Seeing you are relying on win32com, you might as well add the links > directly rather than via the intermediate WScript.shell object. Look in > win32comext\shell\demos\**create_link.py for an example of how to create > shortcuts directly. > > HTH, > > Mark > > On 6/04/2012 5:23 AM, cesar.covarrub...@gmail.com wrote: > >> Hello, >> >> I am working on creating an installer of a Python 3.2 application that we >> programmed. The end goal is to create an installer in which we can specify >> the install path, and create shortcuts in the Start Menu and Desktop. >> Ideally, we would like to give the users the option to create the Desktop >> or Start Menu shortcuts. >> >> I was able to create a .msi file with the setup.py and install.py files >> below. This allowed me to specify the custom default path but not create >> the shortcut in the Start Menu. >> >> Can anyone help me figure out what I'm missing? >> >> >> setup.py >> -------- >> >> from cx_Freeze import setup, Executable >> import sys >> >> productName = "ProductName" >> if 'bdist_msi' in sys.argv: >> sys.argv += ['--initial-target-dir', 'C:\InstallDir\\' + productName] >> sys.argv += ['--install-script', 'install.py'] >> >> exe = Executable( >> script="main.py", >> base="Win32GUI", >> targetName="Product.exe" >> ) >> setup( >> name="Product.exe", >> version="1.0", >> author="Me", >> description="Copyright 2012", >> executables=[exe], >> scripts=[ >> 'install.py' >> ] >> ) >> ------------------------------**----------- >> >> install.py >> ---------- >> import os >> import sys >> import win32com.client as w32client >> >> shortcut_group_name = "Start Menu Dir" >> shortcut_name = "Product Name" >> shortcut_target = "http://www.microsoft.com" >> >> sh = w32client.Dispatch("WScript.**Shell") >> p = sh.SpecialFolders("**AllUsersPrograms") >> assert(os.path.isdir(p)) >> p = os.path.join(p, shortcut_group_name) >> if (not os.path.isdir(p)): >> os.makedirs(p) >> lnk = sh.CreateShortcut(os.path.**join(p, shortcut_name + ".lnk")) >> lnk.TargetPath = shortcut_target >> lnk.Save() >> >> >> > > -- Very Respectfully, Cesar Covarrubias
-- http://mail.python.org/mailman/listinfo/python-list