ramius
1st October 2001 12:41 UTC
Trouble with CreateShortCut
I keep getting an error when trying to use the CreateShortCut command.
I am trying to create a shortcut for a java application with an icon for the shortcut, the shortcut is d I have been using.
CreateShortCut "$SMSTARTUP\WhereIs.lnk" "C:\jdk\bin\javaw.exe" "$OUTDIR\image\whereis.ico" 1 "SW_SHOWMINIMIZED" "ALT|CONTROL|w"
And this is what makeNSIS.exe tells me.
CreateShortCut: cannot interpret icon index
Usage: CreateShortCut shortcut_name.lnk shortcut_target [parameters [icon_file [
icon index [showmode [hotkey]]]]]
showmode=(SW_SHOWNORMAL|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED)
hotkey=(ALT|CONTROL|EXT|SHIFT)|(F1-F24|A-Z)
Error in script "C:\WINDOWS.000\Skrivebord\whereis.nsi" on line 35 -- aborting creation process
I cant figure uot what I am doing wrong... hope somebody can help me.
Repzilon
2nd October 2001 01:01 UTC
The first icon index in a ICO, DLL or EXE file 0, not 1.
kfank
27th February 2008 23:20 UTC
ramius is missing the parameters argument in his call to CreateShortCut.
But I get the same error if I try to pass the icon index through a variable:
>>>CreateShortCut "$SMPROGRAMS\$InstallerBrand\MyLink.lnk" "$INSTDIR\My.exe" "" "$INSTDIR\My.exe" "$IconIdx"
>>>CreateShortCut: cannot interpret icon index
If I replace $IconIdx with a number (e.g., 0 or 1) it compiles fine. Bug?
Red Wine
27th February 2008 23:29 UTC
Not a bug of course, you're confusing compile time and run time. Variables are in action at run time.
kfank
28th February 2008 00:18 UTC
But my user variable $InstallerBrand works fine in this case. Is it the difference between a string and an integer?
Red Wine
28th February 2008 00:25 UTC
Compiler expects an integer for the specific parameter while the variable is empty when compiling. Try a definition instead, e.g. !define IconIdx "0".
Afrow UK
28th February 2008 13:55 UTC
Quite simply, the icon index has to be a static hard-coded value.
Stu
Yurik
1st December 2011 16:30 UTC
Met the same issue. It is quite strange that compile-time value is required here. Why? And how do I choose icon dynamically?