Archive: Defining order of Shortcut menu item appearence


Defining order of Shortcut menu item appearence
Hi,

I'm using NSIS version 1.98 on Windows 2000 to create installation program for my application. While creating shortcuts using CreateShortCut' directive in the script, I'm not able to define the order in which they appear on the Windows start menu. These short cuts appear in random order on different machine. In otherwords, following directive in .nsi file:

CreateShortCut "$SMPROGRAMS\Test\S1.lnk" "notepad s1.txt"
CreateShortCut "$SMPROGRAMS\Test\S2.lnk" "notepad s2.txt" CreateShortCut "$SMPROGRAMS\Test\S3.lnk" "notepad s3.txt"
CreateShortCut "$SMPROGRAMS\Test\S4.lnk" "notepad s4.txt"

The above directives cause the short cut menus to appear in random order as shown below. Also, this order is different on different machines.

Start -> Test -> S3
-> S1
-> S4
-> S4

Can anyone please let me know how I could define the order in which they appear on the Windows start menu.

Thanks,

Kishore.


In Win98SE there's a registry branch (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu) where windows stores items' positions. You can define as you like, export the branch you want, and then import that branch during installation with thi line: ExecWait "REGEDIT.EXE /S 1.REG"


Originally posted by n0On3
In Win98SE there's a registry branch (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu) where windows stores items' positions. You can define as you like, export the branch you want, and then import that branch during installation with thi line: ExecWait "REGEDIT.EXE /S 1.REG"
Thanks a lot for the reply. Since, I'm new to both windows and NSIS, It will be very helpful if you can give me the detailed steps for the example I had initially posted with the question.

Thanks,

Kishore.

Originally posted by n0On3
In Win98SE there's a registry branch (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu) where windows stores items' positions. You can define as you like, export the branch you want, and then import that branch during installation with thi line: ExecWait "REGEDIT.EXE /S 1.REG"
Hello n0On3,

Following is the snippet of the nsi script used in my installation.

;Script Begin

CreateShortCut "$SMPROGRAMS\Test\S1.lnk" "notepad s1.txt"
CreateShortCut "$SMPROGRAMS\Test\S2.lnk" "notepad s2.txt" CreateShortCut "$SMPROGRAMS\Test\S3.lnk" "notepad s3.txt"
CreateShortCut "$SMPROGRAMS\Test\S4.lnk" "notepad s4.txt"
ExecWait 'RegEdit /s /e "$INSTDIR\1.reg" "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu"'

ExecWait 'RegEdit /s "$INSTDIR\1.reg"'

;Script End

But, the order still seems to be random. Is this what I'm supposed to do ? Please let me know.

Thanks,

Kishore.

You can't set the order of the items in the Start-Menu. However, if you have Windows ME or higher, you can, as a user, sort the items by name.


virtlink, well you can't set the order, but you can import the branch where windows saves the order, methinks.


I don't know why you use the "/e" switch.

before using this: ExecWait 'RegEdit /s "$INSTDIR\1.reg"'

you have to create '1.reg' with the information you want. To do it, create the start menu group the way you want it to be installed, and launch regedit go to that branch I gave you look for your start groug and export the branch of that group to that 1.reg file.

If you have any trouble you can post your working script to check it with my computer.


This solution is working on windows 2000, but doesn't seem to work on XP... Any clue to do the same on XP? haven't test on Win Nt4, but will do the test soon.

Thank you.


You can use Registry Shot to find what really changes in the registry when changing the order of items.

You'll have to do it by yourself, because I don't have a wxp around.

good luck :)


Thanks!

BTW< the file you sent was not working.. old version I guess!

Here a more recent file of regshot.


Yeah, the n0On's version didn't accept Windows XP as a valid OS, since it doesn't support NT systems, and recognizes XP as one.


Okay, I've done a switch between XP, 2000 and NT 4.0 for the ordering items... Something like this:

Call GetWindowsVersion
Pop $R0
StrCmp $R0 "2000" 0 +2
ExecWait 'RegEdit /s "$PLUGINSDIR\2000 Client.reg"'
StrCmp $R0 "XP" 0 +2
ExecWait 'RegEdit /s "$PLUGINSDIR\XP Client.reg"'
StrCmp $R0 "NT 4.0" 0 +2
ExecWait 'RegEdit /s "$PLUGINSDIR\NT 4.0 Client.reg"'

Does work fine, but for the current user... If I logoff and logon another user, doesn't get the menu items ordered correctly... I've tried to edit the reg file by changing the HKCU for HKLM, but none of these windows version will work... Only work in current user who've done the installation.

Is there any way to make it applied to another user?


hehe, it seems I have to update my computer, the OS, and regshot too. :rolleyes:


Isn't a good opportunity? ;) eheheh


This is my solution for right sort order:

CreateShortCut "$SMPROGRAMS\...
Sleep 10
CreateShortCut "$SMPROGRAMS\...
Sleep 10
CreateShortCut "$SMPROGRAMS\...


Try:

4.9.7.3 SetShellVarContext current|all

before your createshortcut calls for setting the appropriate location.