Open link in new browser window: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author links.) |
m (Added category links.) |
||
Line 43: | Line 43: | ||
Thanks to Ryan Farley (http://ryanfarley.com/blog/archive/2004/05/16/649.aspx ) for an idea. | Thanks to Ryan Farley (http://ryanfarley.com/blog/archive/2004/05/16/649.aspx ) for an idea. | ||
[[{{ns:14}}:Internet Functions]] |
Revision as of 22:24, 30 April 2005
Author: techtonik (talk, contrib) |
Description
Link opened via ExecShell "open" "http://nsis.sf.net/" may happen to be loaded in existing browser window thus erasing previous content. Here is NSIS function to open link in new window. Place a link into $0 and enjoy. =)
The Function
# Uses $0 Function openLinkNewWindow Push $3 Push $2 Push $1 Push $0 ReadRegStr $0 HKCR "http\shell\open\command" "" # Get browser path DetailPrint $0 StrCpy $2 '"' StrCpy $1 $0 1 StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char StrCpy $2 ' ' StrCpy $3 1 loop: StrCpy $1 $0 1 $3 DetailPrint $1 StrCmp $1 $2 found StrCmp $1 "" found IntOp $3 $3 + 1 Goto loop found: StrCpy $1 $0 $3 StrCmp $2 " " +2 StrCpy $1 '$1"' Pop $0 Exec '$1 $0' Pop $1 Pop $2 Pop $3 FunctionEnd
Thanks to Ryan Farley (http://ryanfarley.com/blog/archive/2004/05/16/649.aspx ) for an idea.