Old 13th February 2013, 23:18   #1
Arth
Junior Member
 
Join Date: Feb 2013
Posts: 3
Question Problem with shortcut icon and NSIS

I am trying to get an external icon installed in the program .lnk but it is not working for me. The following is the nsis.nsi statements that are involved:

!define APP_NAME "Fescue"
!define VERSION "01.00.00.00"
!define DESCRIPTION "Application"
!define INSTALLER_NAME "\Dropbox\Fescue\setup.exe"
!define MAIN_APP_EXE "Fescue.rex"
!define MAIN_APP_ICO "Fescue.ico"
!define INSTALL_TYPE "SetShellVarContext current"

!ifdef REG_START_MENU
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$SM_Folder"
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" \
"$INSTDIR\${MAIN_APP_EXE}" "$INSTDIR\${MAIN_APP_ICO}"
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" \
"$INSTDIR\${MAIN_APP_ICO}"
CreateShortCut "$SMPROGRAMS\$SM_Folder\Uninstall ${APP_NAME}.lnk" \
"$INSTDIR\uninstall.exe"
!endif

When I look at the .lnk file with a hex editor, or select properties on the program icon, it appears the .ico file information has been appended to the end of the target field for the program. If I manually select to change the icon on the properties panel, it works okay, but the .ico information is located in a different place in the .lnk file. Suggestions on how to get around this problem? This is on a Windows XP Pro system.
Arth is offline   Reply With Quote
Old 14th February 2013, 03:32   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,542
Make sure $INSTDIR\${MAIN_APP_EXE} and ${MAIN_APP_ICO} exist before you call CreateShortcut...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 14th February 2013, 14:21   #3
Arth
Junior Member
 
Join Date: Feb 2013
Posts: 3
Question

Thanks Anders, but if you read my original post, the following defines are at the first part of my script:
!define MAIN_APP_EXE "Fescue.rex"
!define MAIN_APP_ICO "Fescue.ico"
Is there another solution or work around?
Arth is offline   Reply With Quote
Old 14th February 2013, 15:21   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Anders means that the folders and files must exist before the shortcut is created.
MSG is offline   Reply With Quote
Old 14th February 2013, 15:56   #5
Arth
Junior Member
 
Join Date: Feb 2013
Posts: 3
Sorry for being so dense, but see the following from my original post:
CreateDirectory "$SMPROGRAMS\$SM_Folder"
CreateShortCut "$SMPROGRAMS\$SM_Folder\${APP_NAME}.lnk" \
"$INSTDIR\${MAIN_APP_EXE}" "$INSTDIR\${MAIN_APP_ICO}"
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${MAIN_APP_EXE}" \
"$INSTDIR\${MAIN_APP_ICO}"

As I stated in the original post, the shortcut is there with the execution parameter filled in and the ico parameter is also there, but following the execution parameter in the target field like:
C:\Fescue\fescue.rex C:\Fescue\fescue.ico
the fescue.ico file is also in the C:\Fescue folder after the setup.exe install has been run. I suspect the problem is with the executable not being an .exe or .dll, but the .rex is defined to have ooRexx.exe start and that is passed as the startup parameter. That all works okay - just the icon is NOT present on either the desktop or the Start Menu folder. I am asking if there is a workaround or how this should be handled.
Arth is offline   Reply With Quote
Old 14th February 2013, 18:58   #6
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Arth, you still don't seem to be answering Anders' concern. When you execute the code to create the SMPrograms folder and the shortcut, has the executable file been extracted yet? If the file isn't yet on the target computer, the shortcut icon won't be set properly.
demiller9 is offline   Reply With Quote
Old 14th February 2013, 20:25   #7
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,542
You forgot a parameter:
Quote:
Createshortcut foo.lnk bar.exe "" baz.ico

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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