Search code examples
nsisshortcut

Define a shortcut in NSIS


This is the code that I'm using. The shortcut instead of point to $text point to "C:\Users\ze\Desktop\329328" :s Any suggestion?!

Thanks

Function nsDialogsPage

    nsDialogs::Create 1018
    Pop $Dialog

    nsDialogs::SelectFileDialog open "$PROGRAMFILES\InduSoft Web Studio v7.0\Bin\RunStartUp.exe" "*.exe"

    Pop $Text

    ${NSD_CreateText} 0 13u 100% -13u $Text
    Pop $Text

    nsDialogs::Show

    CreateShortCut "$SMPROGRAMS\My application\My application.lnk" "$Text"
    CreateShortCut "$DESKTOP\My application.lnk" "$Text"

FunctionEnd

Solution

  • The pop $Text statement stores the windows handle of the created text, not its text content (the reference documentation is misleading in that point). In your example the returned handle was 329328, that explains the strange link target.

    To get the contents, you can use the ${NSD_GetText} like that:

    ${NSD_CreateText} 0 13u 100% -13u $TextToShow
    Pop $TextHandle
    ;...
    ;...
    ${NSD_GetText} $TextHandle $0 ; $0 will receive the text string