Archive: Make correct CreateShortCut's


Make correct CreateShortCut's
Hello together,

i want to make a ShortCut entry that starts the local mail client with a default mail title an a default mail body.

(first: my experiences with NSIS are limited and so my code looks very credulous)

The ideal ShortCut entry would be like that:

"C:\Programme\Mozilla Thunderbird\thunderbird.exe" mailto:name@domain.de?subject=mailtitle&body=bla_bla

But the result is always:

"C:\"C:\Programme\Mozilla Thunderbird\thunderbird.exe" " mailto:name@domain.de?subject=mailtitle&body=bla_bla

Well, my problem is the correct handling of the strings; i'm convinced there is a more elegant solution than mine ;-)

Many thanks for your help
Dieter

And that's my naive code:


Section "Start Menu Shortcuts"

Var /GLOBAL MailURL
Var /GLOBAL MailPgm
Var /GLOBAL MailPgmTMP

; ----- look for mailto connections...
; HKEY_CURRENT_USER\Software\Classes\mailto\shell\open\command
ReadRegStr $MailPgmTMP HKCU "Software\Classes\mailto\shell\open\command" ""
${If} $MailPgmTMP != ""
StrCpy $MailPgm $MailPgmTMP
${EndIf}

; HKEY_CLASSES_ROOT\mailto\shell\open\command
ReadRegStr $MailPgmTMP HKCR "mailto\shell\open\command" ""
${If} $MailPgmTMP != ""
StrCpy $MailPgm $MailPgmTMP
${EndIf}

; HKEY_LOCAL_MACHINE\SOFTWARE\Classes\mailto\shell\open\command
ReadRegStr $MailPgmTMP HKLM "SOFTWARE\Classes\mailto\shell\open\command" ""
${If} $MailPgmTMP != ""
StrCpy $MailPgm $MailPgmTMP
${EndIf}

StrCpy $MailURL mailto:name@domain.de?subject=mailtitle&body=bla_bla

MessageBox MB_OK $MailPgm
${StrRep} $MailPgm $MailPgm "/mailurl:" ""
${StrRep} $MailPgm $MailPgm "/defini" ""
${StrRep} $MailPgm $MailPgm "-osint" ""
${StrRep} $MailPgm $MailPgm "-compose" ""
${StrRep} $MailPgm $MailPgm "%1" ""
${StrRep} $MailPgm $MailPgm '""' ""
; ${StrRep} $MailPgm $MailPgm %1 ""
MessageBox MB_OK $MailPgm

CreateDirectory "$SMPROGRAMS\MyEntry"
CreateShortCut "$SMPROGRAMS\MyEntry\Mail to me.lnk" $MailPgm $MailURL $MailPgm 0

SectionEnd


NSI file
... and thats my complete nsi file


From the FAQ:

http://nsis.sourceforge.net/I_am_hav...CreateShortcut

Parameters for the executable should be passed as a separate parameter for CreateShortcut.