Subscribe Bookmark RSS Feed

monitoring JMP usage

michaelcorleone

Community Trekker

Joined:

Jul 11, 2012

Hi,

Would it be possible to write a JSL script to monitor JMP usage.

For example if could you write a code that would start automatically when you open JMP?

Say if there multiple users, ideally you would want to see: (1) who was using the tool and (2) how often and how long they are using it for?

Or even if that wasn't possible, just a script that would send an email to me automatically once somebody in our group opened JMP?

Thanks in advance

14 REPLIES
michaelcorleone

Community Trekker

Joined:

Jul 11, 2012

Can anybody give me any advice on this?

klaus819

Community Trekker

Joined:

Feb 20, 2012

If this is running on a Windows system this is very easily accomplished.  I am not sure how difficult this would be on other operating systems.

ms

Super User

Joined:

Jun 23, 2011

You can have a jsl script that runs automatically when JMP is started. Look in the JMP scripting guide page 259 (JMP 10).

This snippet below should send a mail with User and Time information each time someone starts JMP. The script must be named jslStart.jsl and placed locally in C:\ProgramData\SAS\JMP\ (may differ among Windows versions, check the scripting guide).

However, I am not aware of a command that is activated by exiting JMP. An OS solution is probably more powerful. I have not tested the script below as I use JMP for Macintosh.

// Sends a mail when JMP is started with info on username and start time

If( Host is( Windows ),

  Mail(

  "to@me.com",

  "User " || Word( 3, Get Default Directory(), "/" ) || " runs JMP",

  "User " || Word( 3, Get Default Directory(), "/" ) || "has started a JMP session on " ||

  Format( Today(), "m-d-y h.m" ) || "."

  ),

  "Mail is only available on Windows."

);

michaelcorleone

Community Trekker

Joined:

Jul 11, 2012

Thank you very much for your reply. I used your code above but am having difficulty getting the emails to send through.

I then simplified the code by just running a script to send a mail using this format:

Mail("john.doe@company.com", "subject", "message", )

I keep receiving the following response:

2578_pastedImage_0.png

I use Microsoft Outlook. What is the problem here?

ms

Super User

Joined:

Jun 23, 2011

I am sorry, but I don't think I can be of much help here. Maybe Outlook, in typical Microsoft manner, has a bunch of security measures that are on by default and that prevents communication with JMP. Try to see if there are any relevant security settings for outlook or generally that can be relaxed.

michaelcorleone

Community Trekker

Joined:

Jul 11, 2012

i found the issue on the JMP website. I have 64-bit JMP 10 installed but my Outlook is 32-bit. They need to match up bit-wise apparently

2763_pastedImage_0.png

michaelcorleone

Community Trekker

Joined:

Jul 11, 2012

Yes this is running on Windows. Can you tell me how to do it?!

klaus819

Community Trekker

Joined:

Feb 20, 2012

This sounds like you might have users in a terminal server environment.  Is that correct?  The easiest way to do this would be to write a vbscript that would start when the computer starts.  This would just sleep until someone started jmp and could either send you an email or write to a log.  From experience I would advise writing to a log.  You really don't want to set yourself up to be spammed like that.  There is other information about the users session you might want to gather as well.

Byron_JMP

Staff

Joined:

Apr 26, 2012

I agree with klaus819, and from an admin's perspective there are non-JMP methods for tracking software installs and software use.

Inside JMP, there are some other options besides sending e-mail. I was recently playing with an idea to track my own JMP use using a JMP start up script. The details on how to do it are in the JMP Scripting Guide, somewhere around page 257.

The script below is for JMP10 running in Windows 7, little tweaks are necessary for other operating systems or versions (see the reference above). This script will write a new row in a data table every time JMP is stated. Its set up to run without being displayed.

I used another similar script where the "event" variable has another definition, and the script is run by the windows scheduler at specified times. In this case the script only runs if my laptop is running, which is a surrogate for me running too.

The script depends on having a specific data table with specific column names. This table script is included at the end of the script below.

//!

//  "//!" on the first line of a script lets the script open and run without being displayed.

//  When this script is opened, it will run, and then close. To open it, to edit it, right click on it from the JMP Home Window file list and //  select "Edit".

//Notes:

//This script opens a file called Data1.jmp. The script for an empty table is included below

//In practice, the "log" file would be on a directory that all users have access to

//The script will run when any user opens JMPon this computer

//

//The script must have this name:  jmpStartAdmin.jsl

//The script can be in several places in windows 7

// ref: Scripting Guide p.257 (JMP 10)

// Save the script here (assuming JMP is installed here) C:\ProgramData\SAS\JMP\jmpStartAdmin.jsl

//  If there is already a jmpStartAdmin.jsl file, it probably wouldn't be a good idea to write over it.

////////////////////////////////////////////////////////The script

Names Default To Here( 1 );

////////Step 1: Get the Username and ID (from R. Lucas (thank you))

// See http://msdn2.microsoft.com/en-us/library/ms724435.aspx

NameUnknown = 0;

NameFullyQualifiedDN = 1;

NameSamCompatible = 2;

NameDisplay = 3;

NameUniqueId = 6;

NameCanonical = 7;

NameUserPrincipal = 8;

NameCanonicalEx = 9;

NameServicePrincipal = 10;

NameDnsDomain = 12;

securDll = Load DLL( "Secur32.dll", AutoDeclare( false ) );

securDLL << DeclareFunction(

    "GetUserNameExW",

    Arg( Int32 ),                              // Name format (use code from above)

    Arg( UnicodeString( 80 ), output ),          // Name buffer

    Arg( UInt32, update )                   // Buffer length

);

UserName = "";

Userid = "";

NameLen = 80;

securDLL << GetUserNameExW( NameDisplay, UserName, NameLen );

securDLL << GetUserNameExW( NameSamCompatible, Userid, NameLen );

Show( UserName );

Show( Userid );

ver=JMP Version();

/////////Step 2: Open the file you want to add information to

//note: you have to add your own file path for the location of the data table

dt=open("C:\file path\Data1.jmp",invisible); //the invisible argument hides it from the user.

////////Step 3: Add the information to the data table

dt<<AddRows({Col1=today(),Event="Start Up",:name("User Name")=UserName, UserID=Userid, Version=ver});

////////Step 4: Close the log data table

close(dt,save("C:\file path\Data1.jmp"));

//Exit(); This closes (exits) JMP right after the script runs

//if this script were run with the windows scheduler this would

//be a convenient step to run, but in this case it would be really really annoying.

///////////////////////////////////////////////////////////////////end of Script

//This is the table script for "Data1.jmp", run this to make the initial empty data table

//Then save it as your file path so that the script can use it.

/*

New Table( "Data1",

  Add Rows( 0 ),

  New Column( "TimeStamp",

  Numeric,

  Continuous,

  Format( "m/d/y h:m:s", 23, 0 ),

  Input Format( "m/d/y h:m:s", 0 ),

  Set Values( [] )

  ),

  New Column( "Event", Character, Nominal, Set Values( {} ) ),

  New Column( "User Name", Character, Nominal, Set Selected, Set Values( {} ) ),

  New Column( "UserID", Character, Nominal, Set Values( {} ) ),

  New Column( "Version",

  Numeric,

  Continuous,

  Format( "Best", 12 ),

  Set Values( [] )

  ),

  New Column( "Date",

  Numeric,

  Continuous,

  Format( "m/d/y", 12 ),

  Input Format( "m/d/y" ),

  Formula( :TimeStamp - Time Of Day( :TimeStamp ) )

  ),

  New Column( "Duration to Complete Task",

  Numeric,

  Continuous,

  Format( "hr:m", 12 ),

  Input Format( "hr:m" ),

  Formula( Time Of Day( :TimeStamp - :Target Time ) )

  ),

  New Column( "Target Time",

  Numeric,

  Continuous,

  Format( "h:m", 8 ),

  Input Format( "h:m" ),

  Set Values( [] )

  ),

  New Column( "Day of Week",

  Numeric,

  Continuous,

  Format( "Best", 12 ),

  Formula( Day Of Week( :TimeStamp ) )

  )

)