|
|
|
|
#1 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
How to open a folder
Is there something like MUI_FINISHPAGE_RUN that I can use to simply open a folder? Or what else would you suggest?
|
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
One of my installers has an option to display a folder using this command
code: |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
Thank you. I will keep that in mind. Since I am wanting to open the folder from the finish page, it looks like I need to use MUI_FINISHPAGE_RUN_FUNCTION, as demonstrated at http://nsis.sourceforge.net/Run_an_a...er_an_install.
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
Now that I have the folder opening with
Function LaunchLink ExecShell "" "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" FunctionEnd I am failing to associate my icon with the desktop shortcut. Is there anything wrong with the following syntax? CreateShortCut "$DESKTOP\${DESKTOP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}" "C:\Hand in Hand\Room 101\res\Install_Icon.ico" |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
My target is displaying:
"C:\Program Files\Max and Max Spanish\On the Go Spanish General Set 1" C:\Hand in Hand\Room 101\res\Install_Icon.ico |
|
|
|
|
|
#6 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
you forgot the parameter (use "") (how is CreateShortCut supposed to guess that C:\Hand in Hand\... is a icon and not a parameter? You can't leave things out, the order must be correct)
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#7 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
Would you mind being more specific? I am looking at the docs and web samples, but something just isn't clicking.
Thanks! |
|
|
|
|
|
#8 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
Okay, I got it. Thanks!
|
|
|
|
|
|
#9 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
Now why won't that desktop shortcut open when I double-click on it, without asking me what application to use?
If I manually enter a "\" at the end of the path in the Target textbox of the shortcut's dialog, apply the change and then try the double-click on the desktop icon again, it opens the folder correctly. Yet including the slash in the code has no effect. |
|
|
|
|
|
#10 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
I'm not sure if NSIS or windows is stripping it off but
seems to workcode: The NSIS installer used to create a directory shortcut a couple of versions ago, you could check and see how it does it IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
No, NSIS installer is not stripping out the slash, but the slash should not be needed. And even the actual desktop shortcut removes the manually entered slash, yet it then behaves as expected.
I appreciate your workaround, but if this is a bug, I want to know it. There doesn't seem to be a parameter to indicate a directory versus a file either, so I am not sure what to think about this situation. Thank you for all of your help tonight. |
|
|
|
|
|
#12 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
From what I can tell, when the target folder and .lnk are on the same partition, IShellLink will automatically add a relative path (.lnk has SLDF_HAS_RELPATH flag)
If I call psl->SetRelativePath("",0); before ppf->Save(...) the .lnk does not include a relative path. It should be noted that when drag&drop'ing "my documents" folder to create a shortcut on the same partition, the .lnk created by explorer also has a relative path. SLDF_HAS_RELPATH might not matter at all (But my initial test spanned drives so I had no relative paths, and that is why I investigated that flag) On my system right now, no matter what I do, I can't seem to create a broken shortcut. works just fine (When I first responded to your post, I just got the "open with" dialog, maybe a shell bug or something, who knows)code: IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
I see now that we are describing two different situations. Yes, your code opens a window immediately. But I am talking about the application desktop item.
Still the shortcut wants a program to be specified before opening. And again, if I open the shortcut, edit it in any manner and close it, it works fine. Section "MainSection" SEC01 MessageBox MB_YESNO "Would you like to have a shortcut on your desktop?" IDNO +2 Call DesktopShortcut Function DesktopShortcut SetOutPath $appdata ;"random" outdir CreateShortCut "$DESKTOP\${DESKTOP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}" "" "${MUI_ICON}" FunctionEnd Last edited by SteveRussell; 28th February 2010 at 04:33. |
|
|
|
|
|
#14 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
well, its not like I can tell when you don't show us your defines. Its still not clear to me if you want to open a folder or an application (.exe or whatever)
MUI_ICON makes no sense for example since it is normally a .ico on the machine you BUILD on, not the end users machine code: IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#15 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
In this case, the product being installed is simply a folder containing mp3 files. There is no exe for the user to run. They just need to be able to view the mp3's. I do have the folder open from the finish page, which you helped me to figure out. And apparently, since the shortcut that is installed on the desktop (if they choose YES on the messagebox) is not an exe, I have to specify the icon; otherwise the desktop shortcut uses a generic image.
|
|
|
|
|
|
#16 |
|
Major Dude
Join Date: Mar 2003
Posts: 571
|
I cannot get it to go wrong on my Window 7 system. As Anders has already said, without seeing your code it is hard to see where it is going wrong.
Which version of NSIS are you using? Which version of MUI are you using for your installer: "Modern UI" or "Modern UI 2"? Are you remembering to INSTALL the icon you want to use for the shortcut? |
|
|
|
|
|
#17 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
I just updated to NSIS 2.46.
; Script generated by the HM NIS Edit Script Wizard. ; for Vista RequestExecutionLevel highest Name "OTG Product Set 1" "OTG Product Set 1" Caption "OTG Product Set 1" ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "OTG Product Set 1" !define SPELLED_OUT_PRODUCT_NAME "OurName OTG Product Set 1" !define DESKTOP_NAME "OTG Product Set 1" !define PRODUCT_FAMILY "OurName Language" !define PRODUCT_VERSION "1.0" !define PRODUCT_PUBLISHER "OurName Language Software, LLC" !define PRODUCT_WEB_SITE "http://www.OurSite.com" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\${PRODUCT_FAMILY}\${PRODUCT_NAME}" !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define DEM "OurName Language 1 Demo" BGGradient on BGGradient 000064 7A7ADE notext ; MUI 1.67 compatible ------ !include "MUI2.nsh" !include LogicLib.nsh !include FileFunc.nsh !insertmacro un.GetParent ;-------------------------------- ;Interface Configuration !define MUI_HEADERIMAGE !define MUI_HEADERIMAGE_BITMAP "C:\Hand in Hand\Installers\Header Bitmap.bmp" ;-------------------------------- ; MUI Settings !define MUI_ABORTWARNING !define MUI_ICON "C:\Hand in Hand\Room 101\res\OTG_test.ico" !define MUI_UNICON "C:\Hand in Hand\Room 101\res\OTG_UNxx.ico" !define MUI_WELCOMEFINISHPAGE_BITMAP "C:\Hand in Hand\Installers\WelcomeFinish.bmp" ; Instfiles page preparations; must be placed early on this page, not in the install page section !define MUI_INSTFILESPAGE_COLORS "${MUI_TEXT_COLOR} ${MUI_BGCOLOR}" !define MUI_INSTFILESPAGE_PROGRESSBAR "smooth" ;try this for custom welcome !define MUI_WELCOMEPAGE_TITLE "${SPELLED_OUT_PRODUCT_NAME} is ready to be installed. Click Next to get going!" !define MUI_WELCOMEPAGE_TITLE_3LINES !define MUI_WELCOMEPAGE_TEXT '' ; Welcome page !insertmacro MUI_PAGE_WELCOME ; License page !define MUI_LICENSEPAGE_CHECKBOX !define MUI_LICENSEPAGE_TEXT_TOP "" !define MUI_LICENSEPAGE_TEXT_BOTTOM "If you accept the terms of the Agreement, click the checkbox below." !insertmacro MUI_PAGE_LICENSE "c:\Hand in Hand\Data\Software License.txt" ;try this for custom directory !define MUI_PAGE_HEADER_TEXT "Recommended installation directory" !define MUI_PAGE_HEADER_SUBTEXT " " !define MUI_DIRECTORYPAGE_TEXT_TOP '$\nSetup will install ${SPELLED_OUT_PRODUCT_NAME} in the folder below.$\n$\n(If you prefer a different location, click Browse and make your choice.)$\n$\nClick Install to continue.' !define MUI_DIRECTORYPAGE_TEXT 'text on the page' ; Directory page !insertmacro MUI_PAGE_DIRECTORY ; Instfiles page !insertmacro MUI_PAGE_INSTFILES ; Finish page !define MUI_FINISHPAGE_TITLE '${SPELLED_OUT_PRODUCT_NAME} has been installed. Are your speakers turned on?' !define MUI_FINISHPAGE_TEXT "Click Finish and be on your way!" !define MUI_FINISHPAGE_TEXT_LARGE !define MUI_FINISHPAGE_TITLE_3LINES ;'${DAPRODUCT_NAME} has been installed. ARE YOUR SPEAKERS TURNED ON?' !define MUI_FINISHPAGE_RUN !define MUI_FINISHPAGE_RUN_TEXT "Open your ${PRODUCT_NAME} folder." !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink" !define MUI_FINISHPAGE_LINK_COLOR FF0000 !insertmacro MUI_PAGE_FINISH ; Uninstaller pages !insertmacro MUI_UNPAGE_INSTFILES ; Language files !insertmacro MUI_LANGUAGE "English" ; MUI end ------ OutFile "MMOtGSpGen1Setup.exe" InstallDir "$PROGRAMFILES\${PRODUCT_FAMILY}" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" ShowInstDetails show ShowUnInstDetails show Section "MainSection" SEC01 MessageBox MB_YESNO "Would you like to have a shortcut on your desktop?" IDNO +2 Call DesktopShortcut CreateDirectory "$INSTDIR\${PRODUCT_NAME}" CreateDirectory "$SMPROGRAMS\${PRODUCT_FAMILY}" CreateDirectory "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}" CreateShortCut "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}" "" "${MUI_ICON}" ; CreateDirectory "$INSTDIR\${PRODUCT_NAME}" SetOutPath "$INSTDIR\${PRODUCT_NAME}" SetOverwrite ifnewer File /nonfatal /r "c:\Hand in Hand\otg\*.*" SectionEnd Section -AdditionalIcons WriteIniStr "$INSTDIR\${PRODUCT_FAMILY}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" CreateShortCut "$SMPROGRAMS\${PRODUCT_FAMILY}\Website.lnk" "$INSTDIR\${PRODUCT_FAMILY}.url" CreateShortCut "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\Uninstall.lnk" "$INSTDIR\${PRODUCT_NAME}\uninst.exe" SectionEnd Section -Post WriteUninstaller "$INSTDIR\${PRODUCT_NAME}\uninst.exe" WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\${PRODUCT_NAME}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\${PRODUCT_NAME}\uninst.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" SectionEnd Function un.onUninstSuccess HideWindow MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer." FunctionEnd Function un.onInit MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2 Abort FunctionEnd Section Uninstall ${un.GetParent} "$INSTDIR" $R0 Delete "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\Uninstall.lnk" Delete "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" Delete "$DESKTOP\${DESKTOP_NAME}.lnk" Delete "$DESKTOP\${PRODUCT_NAME}.lnk" ; in case this exists from an earlier installation Delete "$R0\${PRODUCT_NAME}" RMDir /r "$INSTDIR" RMDir "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" SetAutoClose true SectionEnd Function LaunchLink ExecShell "" "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" FunctionEnd Function DesktopShortcut SetOutPath $appdata ;"random" outdir CreateShortCut "$DESKTOP\${DESKTOP_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}" "" "${MUI_ICON}" ; execshell "" "$DESKTOP\${DESKTOP_NAME}.lnk" FunctionEnd |
|
|
|
|
|
#18 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
I have found that, after the initial installation, this installer is producing an install directory that reflects the last installation, i.e. "$INSTDIR\${PRODUCT_NAME}", next "$INSTDIR\${PRODUCT_NAME}\${PRODUCT_NAME}"
and so forth, burying the install deeper and deeper, rather than rewriting. Whereas I expect "$PROGRAMFILES\${PRODUCT_FAMILY}". This is the first time I have treated a folder, instead of an exe, as a product, and it seems to be causing me new challenges. |
|
|
|
|
|
#19 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
Adding a trailing backslash seems to have solved the install directory problem:
InstallDir "$PROGRAMFILES\${PRODUCT_FAMILY}/" InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}/" "" As for the desktop shortcut that fails to be associated with a program, if I reinstall without unistalling, it works fine. So what is causing/fixing this problem? |
|
|
|
|
|
#20 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
You create the shortcut before the destination exists, DON'T DO THAT (That is why see a broken icon also probably)
IntOp $PostCount $PostCount + 1 |
|
|
|
|
|
#21 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
You're right! Fixed. Thanks, Anders, for hanging in there with me on this.
|
|
|
|
|
|
#22 |
|
Senior Member
Join Date: Mar 2006
Location: United States
Posts: 109
|
And how can I set attributes/details in this folder (that is opened at the conclusion of installation)? I.e. Title, Track number and column widths?
CreateDirectory "$INSTDIR\${PRODUCT_NAME}" . . . !define MUI_FINISHPAGE_RUN_TEXT "Open your ${PRODUCT_NAME} folder." !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink" . . . Function LaunchLink ExecShell "" "$SMPROGRAMS\${PRODUCT_FAMILY}\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" FunctionEnd |
|
|
|
|
|
#23 |
|
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
|
If you were to open this folder using COM automation, you _might_ be able to add/remove columns. But the format of stored info for closed folders are undocumented (IIRC search for "shell bag" in the registry)
IntOp $PostCount $PostCount + 1 |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|