Question

When presenting the first version of my Skript-Installer to the customer, the reaction was "great, now we should automatically add links to Desktop and Quickstart". I was sure that it is possible. And it was MUCH easier than suspected.

Solution

   1 print >> ofi, r"[Files]"
   2         for path in self.windows_exe_files + self.lib_files:
   3             print >> ofi, r'Source: "%s"; DestDir: "{app}\%s"; Flags: ignoreversion' % (path, os.path.dirname(path))
   4 
   5         print >> ofi, """
   6 [Tasks]
   7 Name: "quicklaunchicon"; Description: "Icon in Schnellstartleiste erstellen"; GroupDescription: "Weitere Möglichkeiten, das Programm aufzurufen:"; Flags: checkedonce 
   8 Name: "desktopicon"; Description: "Verknüpfung auf &Desktop erstellen"; GroupDescription: "Weitere Möglichkeiten, das Programm aufzurufen:"; Flags: checkedonce 
   9         """
  10 
  11 
  12         print >> ofi, r"[Icons]"
  13         for path in self.windows_exe_files:
  14             print >> ofi, r'Name: "{group}\%s"; Filename: "{app}\%s"' % \
  15                   (self.name, path)
  16         print >> ofi, 'Name: "{group}\Uninstall %s"; Filename: "{uninstallexe}"' % self.name
  17         print >> ofi, 'Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\%s"; Filename: "{app}\%s"; Tasks: quicklaunchicon' % (self.name, path)
  18         print >> ofi, 'Name: "{userdesktop}\%s"; Filename: "{app}\%s"; Tasks: desktopicon' % (self.name, path)

Essential are:

[Tasks]
Name: "quicklaunchicon"; Description: "Icon in Schnellstartleiste erstellen"; GroupDescription: "Weitere Möglichkeiten, das Programm aufzurufen:"; Flags: checkedonce 
Name: "desktopicon"; Description: "Verknüpfung auf &Desktop erstellen"; GroupDescription: "Weitere Möglichkeiten, das Programm aufzurufen:"; Flags: checkedonce 

With this tasks the text within Description is presented to the user. ("Create Quicklink Icon", but in German). "checkedonce" presents this choice with the first installation of the software checked, with subsequent installations (without prio Deinstalltion) the Options are unchecked.

and

   1         print >> ofi, 'Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\%s"; Filename: "{app}\%s"; Tasks: quicklaunchicon' % (self.name, path)
   2         print >> ofi, 'Name: "{userdesktop}\%s"; Filename: "{app}\%s"; Tasks: desktopicon' % (self.name, path)

is responsible for creating the appropriate Icons in Quickstart and on the desktop. Statements "Tasks: desktopicon" gives only an Icon if the appropriate option was checked during installation.

(that's more about Innosetup than Py2Exe, but ... both are free, both are great and both are only one click away :)

20040113HAM

QuickStartIcons (last edited 2008-07-08 11:27:43 by localhost)