Our World Statistics Day conversations have been a great reminder of how much statistics can inform our lives. Do you have an example of how statistics has made a difference in your life? Share your story with the Community!
Choose Language Hide Translation Bar

Append a Time Stamp and the Windows Username to Reports

This is a basic script utility that appends a the date and the windows username to the bottom of all the open reports.



Only works on Windows OS: Calls a windows specific .dll

//Stamp all report windows with the user windows user name and date.
//note this only work on Windows operating systems, not OSX
//the dll read came from John Ponte (Thanks) https://community.jmp.com/t5/Discussions/computer-name/td-p/3464
//This is intended packaged in an add-in or as a custom script in the menu bar.
//Byron Wingerd, Aug 18, 2018

dll = Load DLL( "mpr.dll" );
dll << DeclareFunction(
      Convention( STDCALL ),
      Alias ( "GetUserName" ),
      Arg( UInt8, "format", input ),
      Arg( AnsiString, "username", output ),
      Arg( UInt64, "length", update ),
      Returns( UInt32 )
username = "                                                  ";
unlen = length(username);
result = dll << GetUserName(0, username, unlen);
dll << UnloadDLL();
datenow=Long Date( Today() );
note="This Report was Generated by "||username||" on "||datenow;

reportlist= Get Window List(type("Reports")) << Get Window Title() ;

for (i=1 , i <= nitems(reportlist), i++,
	cr=window(reportlist[i] ) ;
	cr<< bring window to front;
	cr << append( Text Box( note) );


@JohnPonte  Thanks for the username tips.


Article Labels
Article Tags