Old 22nd February 2016, 22:24   #1
ajrjaneway
Junior Member
 
Join Date: Feb 2016
Posts: 8
Question Shortcut icon not displayed

I have NSIS 2.50.

I am learning about NSIS and I have a working installation script. However, I cannot get the icon to display on the desktop or in the start menu. I have a 64-bit Win7, but it is a 32-bit application (a .jar). I can change the icon to the correct one in Properties and before I do that, I see the error about not being able to find the .ico file in %Program Files%.

I have searched far and wide and tried a lot of things. I have tried
InstallDirRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion" "ProgramFiles (x86)"

But that didn't help. I have tried adding more backslashes to my paths, but it has made no difference. I have tried using $PROGRAMFILES32 instead of $PROGRAMFILES, but that didn't help.

I tried reading the program files registry key and using that to set my install directory, but it didn't help.

Here are the relevant lines from my script:

InstallDir "$PROGRAMFILES\ObitEdit"
CreateShortCut "$SMPROGRAMS\ObitEdit\ObitEdit.lnk" "$INSTDIR\ObitEdit.jar" "" "$INSTDIR\odt_log.ico"
CreateShortCut "$DESKTOP\ObitEdit.lnk" "$INSTDIR\ObitEdit.jar" "" "$INSTDIR\odt_log.ico"

My icon is 48x48. I've tried adding a zero at the end of the CreateShortCut line, and that didn't help.

Everything works great, there's just no picture showing. I've read enough to understand that it has to do with how $PROGRAMFILES is handled once it gets to Windows. I see people find some way to get around it successfully, but nothing has worked for me.

I'm hopeful someone out there can see what's wrong.
ajrjaneway is offline  
Old 22nd February 2016, 22:49   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,282
Next time please try searching the forum before asking, this has been asked several times already. See http://forums.winamp.com/showthread.php?t=384308 etc. If you already found one of those threads then you should have posted there.

IntOp $PostCount $PostCount + 1
Anders is offline  
Old 24th February 2016, 00:18   #3
ajrjaneway
Junior Member
 
Join Date: Feb 2016
Posts: 8
I did read it

I saw that and did my best to understand it. However, my problem is slightly different in that my icon never works, so it is not just a problem with changing the icon but getting it to show at all. And as I said, I am learning NSIS so I don't understand how I need to change my script to overcome this problem by reading the example in that forum answer. It is very complicated.

What do I need to add to my NSIS script to make my icon show visible?
ajrjaneway is offline  
Old 24th February 2016, 02:30   #4
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 888
Try changing the output directory before creating the shortcuts, like this:
Quote:
SetOutPath "$SMPROGRAMS\ObitEdit"
CreateShortCut "$SMPROGRAMS\ObitEdit\ObitEdit.lnk" "$INSTDIR\ObitEdit.jar" "" "$INSTDIR\odt_log.ico"
SetOutPath "$DESKTOP"
CreateShortCut "$DESKTOP\ObitEdit.lnk" "$INSTDIR\ObitEdit.jar" "" "$INSTDIR\odt_log.ico"

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline  
Old 24th February 2016, 11:37   #5
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,282
Quote:
Originally Posted by ajrjaneway View Post
However, my problem is slightly different in that my icon never works, so it is not just a problem with changing the icon but getting it to show at all.
If you install to c:\test or something simple like that, does it still fail to display the icon?

Is the .ico a valid icon? Does odt_log.ico display correctly in Explorer?

IntOp $PostCount $PostCount + 1
Anders is offline  
Old 25th February 2016, 03:21   #6
ajrjaneway
Junior Member
 
Join Date: Feb 2016
Posts: 8
Thank you for the suggestions.

I tried adding the SetOutPath as JasonFriday13 suggested, but it made no difference.

I tried installing it in c:\test but that made no difference.

Yes, I see the icon in Explorer and in fact when I execute the .jar (see screenshot).



You can see the icon in Explorer on the right, the logo in the task bar in the bottom and the icon in the GUI in the upper left hand corner.

But I still don't see it in the Start menu or on the desktop. I can change it (using Properties) in either place and then it is visible.
ajrjaneway is offline  
Old 25th February 2016, 12:15   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,282
NSIS just uses the normal shortcut API so I'm not sure why it is not working. Please attach a zip file containing the generated broken shortcut and the icon and I'll try to take a look with some of my special shortcut tools.

IntOp $PostCount $PostCount + 1
Anders is offline  
Old 26th February 2016, 01:55   #8
ajrjaneway
Junior Member
 
Join Date: Feb 2016
Posts: 8
Here's the information

Here are the files you requested, Anders. I hope I did it right. I've never tried to zip a shortcut before.

For what it's worth, it doesn't work on 32-bit machines either. I even tried compiling my NSIS script on the 32-bit machine, but it made no difference.

I really appreciate your help.
Attached Files
File Type: zip ObitEdit2.0.zip (816 Bytes, 125 views)
File Type: zip odt_logo.zip (8.0 KB, 127 views)
ajrjaneway is offline  
Old 26th February 2016, 10:54   #9
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,282
The icon contains two identical versions of the 48x48x32bpp image which is pointless but probably not harmful.

The real problem seems to be that the shortcut icon path is "C:\Program Files (x86)\ODT\ObitEdit2.0\odt_log.ico" but your icon is called "odt_logo.ico"!

The shortcut also contains the problematic %ProgramFiles% path that leads to 64-bit troubles but that is a different issue:

Quote:
IconEnvironmentDataBlock
------------------------
Ansi: %ProgramFiles%\ODT\ObitEdit2.0\odt_log.ico
Unicode: %ProgramFiles%\ODT\ObitEdit2.0\odt_log.ico
Just correct the icon path and it should work in most places...

IntOp $PostCount $PostCount + 1
Anders is offline  
Old 28th February 2016, 21:51   #10
ajrjaneway
Junior Member
 
Join Date: Feb 2016
Posts: 8
Well, don't I feel silly. Now I only have that 64-bit thing about changing the icon, but as you say, it's a minor annoyance.

Thank you so much for your patience and your help.
ajrjaneway is offline  
Closed Thread
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
icon, shortcut

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump