User information on each custom button Click

Hi I was thinking about getting a log of user information who uses a certain custom button in NX and save the log file in a common server location.

The log file would contain the button name and the user's name (not sure how it will be as we use Teamcenter) and of course the time the button clicked... is it doable using NXopen?

If you are using menuscript to define your custom buttons, I think this would be fairly easy. Write a journal that takes a string argument (the button name), finds the current user name, and writes that info along with the date and time to a text file of your choosing on your network. In your menuscript, call your journal as the pre-action, passing in the button name (or any text you want). The journal writes the info to your text file and then NX performs the normally assigned button action. You could use this same journal for all your custom buttons by passing in the button name as a custom argument.

Get user name from the OS (this may or may not match the TC login name, depending on your setup)
https://docs.microsoft.com/en-us/dotnet/api/system.environment.username?...

Here's an example of writing to a text file:
http://www.nxjournaling.com/content/write-text-file

Here's how to pass a string argument to your journal from menuscript:
https://docs.plm.automation.siemens.com/tdoc/nx/1872/nx_api/#uid:index_m...

Here's how to create a pre-action in menuscript:
https://docs.plm.automation.siemens.com/tdoc/nx/1872/nx_api/#uid:id1354092