Not the code there dosent work! its just works for one session. But if you write it directly in your shelf file then you dont need to refeer to the path as its inheritted automaticaly. all you need to do is add popupMenu; menuItem; menuItem; menuItem; after your button Except it still get overwritten by save.
becaus on load the shelf only sources what sin the file! wich means all the dirty work was done at save.
One trick is to include the code in doctag and source it for every shelf item. Its rather easy, but a bit tedious.
The other is to preporcess the files before using them, wich is effective.
3 best way is to manualy write the shelves (by this i dont mean doing it manualy but rather doing the code for write manualy), instead of using the saveShelf command. thisway you have full controll over the fact. You can even add standard button in the shelf... and anything you like.
4 cludge way is to use nonstandard syntax that for some reason works in both maya 5 aand 4.5 but no longer in 6. (was to be expected, i use way 3)