Sergiy Radyakin <[email protected]> would like to automatically
add an item to Stata's menu after a new package is installed, and
is wondering if one way to accomplish this is to automatically install
a profile.do file:
> thank you for your confirmation of a bug. Could you please advise on
> how can I add an item to the menu automatically after a package is
> installed without having a user to run an ado file first? I planned to
> deliver a profile.do file which will add an item the next time Stata
> is launched.
Sergiy then went on to list reasons why automatically installing
a profile.do might be a bad idea:
> But this seems to be a bad idea because:
> 1. this file might already exist
> 2. there might be a profile.do superior in the priority list (see manual)
> 3. Stata must be restarted
We here at StataCorp agree. It would be a bad idea to automatically
install a profile.do file on a user's system, and we strongly recommend
against it. There is just too much potential for confusion due
to a user already having a profile.do (which might then no longer
be executed), or due to a user not knowing they had a profile.do installed
automatically at some point and then wondering why a profile.do they added
later was not working.
Sergiy is right that Stata should have a way of allowing users to have
things added to Stata's menu system when a new package is installed
which would benefit from this, but we have not yet provided such a
method. Sergiy's idea of adding to the package file syntax for this
is interesting, and is one possibility for a way we could achieve
this:
> Alternatively, would it be possible to add a keyword "m" to the
> package file syntax for "Menu item", e.g.:
> m "stUser" "Descriptive" "Descriptive Command" "descrcom"
> might create "Descriptive" as a submenu of the "User" menu (if not
> created already) and add a call to descrcom.ado labelled "Descriptive
> Command"
However, I would not expect to see such functionality soon, so for
now our advice would be for Sergiy to let users know what they could
add to their own profile.do (rather than automatically installing one
for them) so that the menus he would like added to their Stata would
be populated upon the startup of Stata.
--Alan
([email protected])
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/