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