Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 19th November 2005, 09:09   #1
Swapan Das
Senior Member
 
Join Date: Nov 2005
Location: Kolkata (Calcutta),India
Posts: 106
Issues related to Start menu shortcuts orders during installation

Purpose of my Installer is:
1) Create a folder by name PosPlus (default c:\PosPlus)
2) Create a sub-folder by name 'samples' in c:\posPlus
This 'samples' sub-folder contains a few application related text files.
These text files are also copied in this sub-folder.
3) Copy/extract pos.exe to c:\PosPlus
4) Copy/extract databack.exe to c:\PosPlus
5) Copy/extract uninst.exe to c:\PosPlus
6) Copy/extract PosPlus.chm to c:\PosPlus
7) Create desktop shortcut for main applicationos.exe
8) Create shortcut in Windows Start Menu->Program->
in following order:
Start Menu-->Program-->Pos Plus-->Pos Plus
-->Backup Manager
-->Pos Manual
-->Samples
-->Uninstall

My problem is that the installer is smoothly installing all the steps mentioned-above,
but the shortcuts in the start menu for Pos Plus are not comming as per my above order.
The 'Uninstall' shortcut is comming as the first option and the others are also not in
the same order as shown above.

One more thing I want to do is that I want to show my sub-folder Samples and its contents in
this start menu. For this I added this line my script :

CreateDirectory "$SMPROGRAMS\PosPlus\Samples"

This helped me in showing the folder "Samples"(empty). Yes it is showing 'empty' although
it contains many text files inside it.

What I want :

Start Menu-->Program-->Pos Plus-->Pos Plus
-->Backup Manager
-->Pos Manual
-->Samples---->t1.txt(shortcut)
---->t2.txt(shortcut)
--->....... and so on when the user clicks samples
and when he clicks t1.txt then that file opens
up in notepad.
-->Uninstall

A fraction of script is given below to understand my issue:

Section "Complete" SEC01
SetOutPath "$INSTDIR"
SetOverwrite ifnewer
File "AppFolder\pos.exe"
CreateDirectory "$SMPROGRAMS\PosPlus"
CreateDirectory "$SMPROGRAMS\PosPlus\Samples"
;CreateShortCut "$SMPROGRAMS\PosPlus\Samples" "$INSTDIR\Samples"
CreateShortCut "$SMPROGRAMS\PosPlus\Pos Plus .lnk" "$INSTDIR\pos.exe"
CreateShortCut "$SMPROGRAMS\PosPlus\Backup Manager.lnk" "$INSTDIR\databack.exe"
CreateShortCut "$DESKTOP\Pos Plus.lnk" "$INSTDIR\pos.exe"
File "AppFolder\databack.exe"
File "AppFolder\Format.txt"
File "AppFolder\PosPlus.chm"
CreateShortCut "$SMPROGRAMS\PosPlus\Pos Manual.lnk" "$INSTDIR\PosPlus.chm"
SetOutPath "$INSTDIR\Samples"
SetOverwrite try
File "AppFolder\Samples\T1.TXT"
File "AppFolder\Samples\T2.TXT"
File "AppFolder\Samples\T5.TXT"
File "AppFolder\Samples\T7.TXT"
File "AppFolder\Samples\T8.TXT"
File "AppFolder\Samples\T9.TXT"
File "AppFolder\Samples\T10.TXT"
File "AppFolder\Samples\T11.TXT"
File "AppFolder\Samples\T12.TXT"
File "AppFolder\Samples\T13.TXT"
File "AppFolder\Samples\T17.TXT"
File "AppFolder\Samples\T18.TXT"
File "AppFolder\Samples\T19.TXT"
File "AppFolder\Samples\T20.TXT"
File "AppFolder\Samples\Format.TXT"
SectionEnd

Section -AdditionalIcons
;WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
;CreateShortCut "$SMPROGRAMS\PosPlus\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
CreateShortCut "$SMPROGRAMS\PosPlus\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\PosPlus.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\PosPlus.exe"
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


Thanks in advance,
With regards,
Swapan Das
Swapan Das is offline   Reply With Quote
Old 19th November 2005, 09:23   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
As iceman_k has already mentioned in your previous thread, Windows manages the order of the shortcuts in the Start menu sorting them by name. You cannot sort it through the installer. The only thing you can do is place a + in front of the main shortcut name to make sure that it's always at the top.

-Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 21st November 2005, 04:17   #3
Swapan Das
Senior Member
 
Join Date: Nov 2005
Location: Kolkata (Calcutta),India
Posts: 106
Dear Stu,
Thanks for the reply.
You said windows manages the shortcuts in the Start menu by sorting them name-wise. Then why my Uninstall shortcut will appear at the top:
Start Menu-->Program-->Pos Plus-->Pos Plus
-->Backup Manager
-->Pos Manual
-->Samples
-->Uninstall
And Please note the shortcuts of NSIS
--->Contrib -->AdvSplash Readme
-->...and all the files
shortcuts.
Similarly I want to show my subfolder "samples" (which is
under my main folder PosPlus) and shortcuts for all the
text files inside the "samples" folder in the same fashion as startmenu->Programs->NSIS->Contrib->AdvSplash Readme.

Please help me. Its very urgent for me.

With regards,
Swapan das
Swapan Das is offline   Reply With Quote
Old 21st November 2005, 14:21   #4
iceman_k
NSIS Dev
 
iceman_k's Avatar
 
Join Date: Feb 2003
Location: Boston, MA, U.S.A.
Posts: 455
Windows does not sort alphabetically by default.
The user has to manually specify alphabetical sorting.
Windows uses some internal logic to sort the menu items.

Edit
Windows uses the following registry value to store the order of the menu items.
Key: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\XYZ
Value: Order

where XYZ is your program group.

The Order registry value is REG_BINARY, so if you can decode it then you can manually rearrange the order of the items.

Cheers,
Iceman_K

EclipseNSIS - An NSIS IDE for the Eclipse Platform | My contributions to the wiki
iceman_k is offline   Reply With Quote
Old 20th September 2007, 08:53   #5
rutsche
Junior Member
 
Join Date: Jun 2007
Posts: 9
i solved the problem by first installing my application, then changing the order manualy. Next I copied the "Order" value, which windows created and used it in my nsi file. e.g.:
WriteRegBin HKCU "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\XYZ" "Order" 00890888003.....

it works
rutsche is offline   Reply With Quote
Old 20th September 2007, 12:36   #6
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Birmingham, England
Posts: 8,202
That's a good solution.

Stu

Need an installer? http://www.afrowsoft.co.uk
Afrow UK is offline   Reply With Quote
Old 21st September 2007, 04:49   #7
Swapan Das
Senior Member
 
Join Date: Nov 2005
Location: Kolkata (Calcutta),India
Posts: 106
Thanks rutsche for replying to my this old thread. You did a brilliant 'trick'. Since I'm pre-occupied with many other things now, hope to test it in near future.

Regards,
Swapan
Swapan Das is offline   Reply With Quote
Old 4th November 2007, 02:38   #8
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 301
check out my new nsisStartMenu Plugin
(no registry trick, the work is done by Windows Shell)
Wizou is offline   Reply With Quote
Old 4th November 2007, 19:56   #9
Wizou
Senior Member
 
Join Date: Aug 2007
Location: Paris, France
Posts: 301
My plugin works by forcing the Shell to do a premature update of your startmenu folder's menu, so that you can be sure that the shortcuts you created before the call will show up before the shortcuts you create after the call.

Note: the nsisStartMenu.dll exports a function that can be used outside NSIS installers
Wizou is offline   Reply With Quote
Old 5th November 2007, 05:02   #10
Swapan Das
Senior Member
 
Join Date: Nov 2005
Location: Kolkata (Calcutta),India
Posts: 106
Thanks Wizou for coming to my this old thread and giving your solution for it.

Anybody who has applied above solutions to resolve this issue do let me know if its working fine and the windows version he/she is using while testing for this issue. Be specific you applied which solution, rutsche's or Wizou's.

Currently I'm into different things, so unable to test these solutions for this issue which troubled me a lot during my initial days of installer creation.

Regards,
Swapan
[ps.:how's everybody there, esp. RedWine?!]
Swapan Das is offline   Reply With Quote
Old 21st August 2008, 21:30   #11
Spilly
Junior Member
 
Join Date: Aug 2007
Posts: 46
If you only want your shortcuts in the start menu to display in alphabetical order, then you can just delete the key referring to your products entry.

The next time the start menu shortcuts are accessed, they will be displayed alphabetically.

Example.

DeleteRegKey "Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu\Programs\XYZ"
Spilly is offline   Reply With Quote
Reply
Go Back   Winamp 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