Create Internet Shorcuts during installation: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.)
(SF: Lobo Lunar -> Joel. FF: Made code width more compact, added indentation to code.)
Line 7: Line 7:
; with a shortcut in the $DESKTOP.
; with a shortcut in the $DESKTOP.
; Modify the macro according to your needs.
; Modify the macro according to your needs.
; Created by Lobo Lunar
; Created by Joel
; Notes:
; Notes:
; URLFile = The name of our .url file.
; URLFile = The name of our .url file.
Line 17: Line 17:


!Macro "CreateURL" "URLFile" "URLSite" "URLDesc"
!Macro "CreateURL" "URLFile" "URLSite" "URLDesc"
WriteINIStr "$EXEDIR\${URLFile}.url" "InternetShortcut" "URL" "${URLSite}"
  WriteINIStr "$EXEDIR\${URLFile}.url" "InternetShortcut" "URL" "${URLSite}"
SetShellVarContext "all"
  SetShellVarContext "all"
CreateShortCut "$DESKTOP\${URLFile}.lnk" "$EXEDIR\${URLFile}.url" "" "$EXEDIR\makeURL.exe" 0 "SW_SHOWNORMAL" "" "${URLDesc}"
  CreateShortCut "$DESKTOP\${URLFile}.lnk" "$EXEDIR\${URLFile}.url" "" \
                "$EXEDIR\makeURL.exe" 0 "SW_SHOWNORMAL" "" "${URLDesc}"
!macroend
!macroend


Function ".onInit"
Function ".onInit"
!insertmacro "CreateURL" "Nsis dev site" "http://nsis.sf.net" "Visit NSIS Development Site"
  !insertmacro "CreateURL" "Nsis Website" "http://nsis.sf.net" "Visit NSIS Website"
MessageBox MB_OK "Done"
  MessageBox MB_OK "Done"
Quit
  Quit
FunctionEnd
FunctionEnd



Revision as of 15:56, 27 April 2005

The Script

; This Macro will create a Internet Shorcut (*.url).
; Well, you might created first then compile it.
; But, let's create a few during installation. :)
; This example put the Internet Shortcut in the $EXEDIR
; with a shortcut in the $DESKTOP.
; Modify the macro according to your needs.
; Created by Joel
; Notes:
; URLFile = The name of our .url file.
; URLSite = The url to the site.
; URLDesc = The description of our shortcut, when mouse hoover it.
 
Name "Create Internet Shorcut"
OutFile "makeURL.exe"
 
!Macro "CreateURL" "URLFile" "URLSite" "URLDesc"
  WriteINIStr "$EXEDIR\${URLFile}.url" "InternetShortcut" "URL" "${URLSite}"
  SetShellVarContext "all"
  CreateShortCut "$DESKTOP\${URLFile}.lnk" "$EXEDIR\${URLFile}.url" "" \
                 "$EXEDIR\makeURL.exe" 0 "SW_SHOWNORMAL" "" "${URLDesc}"
!macroend
 
Function ".onInit"
  !insertmacro "CreateURL" "Nsis Website" "http://nsis.sf.net" "Visit NSIS Website"
  MessageBox MB_OK "Done"
  Quit
FunctionEnd
 
Section "-boo"
;
SectionEnd

Page author: Joelito