|
|
(2 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| {|align=right
| | #REDIRECT [[Creating internet shortcuts]] |
| |<small>Author: [[{{ns:2}}:Comm@nder21|Comm@nder21]] ([[{{ns:3}}:Comm@nder21|talk]], [[{{ns:-1}}:Contributions/Comm@nder21|contrib]])</small>
| |
| |}
| |
| <br style="clear:both;">
| |
| == Introduction ==
| |
| It's a frequently asked question how to create internet shortcuts.
| |
| So, i've written an easy to use macro, doing this for you with a syntax like CreateShortcut.
| |
| Also, there's a function working the same way.
| |
| | |
| == The Macro ==
| |
| === Source ===
| |
| <highlight-nsis>!macro CreateInternetShortcut FILENAME URL ICONFILE ICONINDEX
| |
| WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
| |
| WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconFile" "${ICONFILE}"
| |
| WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconIndex" "${ICONINDEX}"
| |
| !macroend</highlight-nsis>
| |
| | |
| === Example Usage ===
| |
| <highlight-nsis>!insertmacro CreateInternetShortcut \
| |
| "$STARTMENU\NSIS homepage" \
| |
| "http://www.nsis.sf.net" \
| |
| "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico" "0"</highlight-nsis>
| |
| Note:
| |
| "FILENAME" should contain absolute path-information, if not, it will create the shortcut relative to the current "$OUTDIR".
| |
| | |
| == The Function ==
| |
| === Source ===
| |
| (doing just the same as the macro does)
| |
| <highlight-nsis>Function CreateInternetShortcut
| |
| # store the vars and get the settings
| |
| Exch $3 ; the iconindex
| |
| Exch
| |
| Exch $2 ; the iconfile
| |
| Exch 3
| |
| Exch $1 ; the url
| |
| Exch 4
| |
| Exch $0 ; the filename (including path)
| |
| # create the shortcut
| |
| WriteINIStr "$0.url" "InternetShortcut" "URL" "$1"
| |
| WriteINIStr "$0.url" "InternetShortcut" "IconFile" "$2"
| |
| WriteINIStr "$0.url" "InternetShortcut" "IconIndex" "$3"
| |
| # restore the used vars
| |
| Pop $0
| |
| Pop $3
| |
| Pop $2
| |
| Pop $1
| |
| FunctionEnd</highlight-nsis>
| |
| | |
| === Example Usage ===
| |
| <highlight-nsis>Push "$STARTMENU\NSIS homepage"
| |
| Push "http://www.nsis.sf.net"
| |
| Push "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
| |
| Push "0"
| |
| Call CreateInternetShortcut</highlight-nsis>
| |
| | |
| == Feedback ==
| |
| Any suggestions, feature requests or even bug reports?
| |
| Feel free to send me [http://forums.winamp.com/member.php?s=&action=mailform&userid=117645 an email] or [http://forums.winamp.com/private.php?s=&action=newmessage&userid=117645 a private message].
| |
| | |
| Please post any other question, e.g. about usage and customization at the [http://forums.winamp.com/forumdisplay.php?forumid=65 NSIS forums].
| |
| Remember: You're not alone ...
| |
| | |
| [[{{ns:14}}:Internet Functions]]
| |