Archive: CreateShortCut Compile Error when using User Variables


CreateShortCut Compile Error when using User Variables
I'm having an issue when trying to create a short cut. I'm using this function to split the contents of HKCR "HTTP\DefaultIcon". The output is then being used in the CreateShortCut function. My code is below:


ReadRegStr $0 HKCR "HTTP\DefaultIcon" ""
Push ","
Push $0
Call SplitFirstStrPart
Pop $R0 ; Contains path to default browser
Pop $R1 ; Contains icon index

CreateShortCut "$SMPROGRAMS\MyApp\My Link.lnk" "http://localhost/" "" $R0 $R1


Used in this way, NSIS throws an error when it gets to this line. However, if I take out $R1 and replace it with a number then the compile is successful. Ex.

This works:

CreateShortCut "$SMPROGRAMS\MyApp\My Link.lnk" "http://localhost/" "" $R0 1


Just to check that $R1 does in fact contain the icon index I put the output in a message box and it was correct. I'm stumped on this one. I've tried everything I can think of. I'd just leave it hardcoded to 1 if I could but the icon index for IE is 0 and for FireFox it is 1. I don't know what it is for Opera, etc. and that's why I chose to use the DefaultIcon string from the registry.

Any help with this would be extremely appreciated.

Thanks,
-Chris

Hi Chris!

Due to the fact that you're about to create an internet shortcut I suggest creating an url-file. As far as I know the result of the shortcut-creation-process in the Windows Explorer is an url-file as well.

Have a look:

http://nsis.sourceforge.net/CreateIn...o_%26_function

Have a nice day!

Cheers

Bruno


Thanks Bruno!

Your suggestion worked. I still think this may be a bug in the compiler and I'll put some data together and post it in the bugs db on sourceforge.

Thanks again,
-Chris