Create Internet Shorcuts during installation: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.) |
|||
Line 19: | Line 19: | ||
!Macro "CreateURL" "URLFile" "URLSite" "URLDesc" | !Macro "CreateURL" "URLFile" "URLSite" "URLDesc" | ||
WriteINIStr "$EXEDIR\${URLFile}. | WriteINIStr "$EXEDIR\${URLFile}.URL" "InternetShortcut" "URL" "${URLSite}" | ||
SetShellVarContext "all" | SetShellVarContext "all" | ||
CreateShortCut "$DESKTOP\${URLFile}.lnk" "$EXEDIR\${URLFile}.url" "" \ | CreateShortCut "$DESKTOP\${URLFile}.lnk" "$EXEDIR\${URLFile}.url" "" \ | ||
Line 35: | Line 35: | ||
SectionEnd | SectionEnd | ||
</highlight-nsis> | </highlight-nsis> | ||
'''Note:'''<br> | |||
Internet Shortcut file extension MUST be capitalized, e.g:<br> | |||
SomeSite.url <--- error<br> | |||
SomeSite.URL <--- works<br> | |||
<br> | |||
Also it's enough to create only .ini file:<br> | |||
<highlight-nsis> | |||
!macro "CreateURLSortCut" "URLFile" "URLSite" "URLDesc" | |||
WriteINIStr "${URLFile}.URL" "InternetShortcut" "URL" "${URLSite}" | |||
!macroend | |||
</highlight-nsis> | |||
<br> | |||
It will be valid shortcut for valid browser with valid icon. | |||
[[Category:Internet Functions]] | [[Category:Internet Functions]] |
Revision as of 18:03, 27 February 2009
Author: Joel (talk, contrib) |
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
Note:
Internet Shortcut file extension MUST be capitalized, e.g:
SomeSite.url <--- error
SomeSite.URL <--- works
Also it's enough to create only .ini file:
!macro "CreateURLSortCut" "URLFile" "URLSite" "URLDesc" WriteINIStr "${URLFile}.URL" "InternetShortcut" "URL" "${URLSite}" !macroend
It will be valid shortcut for valid browser with valid icon.