# Good way to discriminate between Mathematica/PlayerPro/CDFPlayer

Within a Mathematica program with a graphical user interface I want to programmatically determine whether the code runs in a full Mathematica, a Player Pro or a CDF-Player. There seem to not be any documented functions which would allow to get that information. I understand that this might be on purpose, as the idea is that it shouldn't matter. At least Mathematica Player Pro provides basically the same functionality as Mathematica. But there are some subtle differences and of course the CDFPlayer has well known limitations.

For the moment I have ways to get that information, but they are all somewhat dirty and/or not very reliable:

• Look at variables like $InstallationDirectory or $BaseDirectory and check for known directory names
• Look at SystemInformation[] or Options[$FrontEnd] and use heuristics to get the desired information from what these return. • try something that is known to not work with CDF Player (e.g. export data). Will of course not work for a Player Pro. and of course one could use any combination of these things to get a more reliable result. Does anyone know a better way to get that information? - Is this what you are looking for? official comparison – Vitaliy Kaurov Nov 6 '12 at 17:06 @VitaliyKaurov I think it is about getting info on the environment the code is running in (i.e. Mathematica, Player etc.) – Yves Klett Nov 6 '12 at 17:12 Perhaps try $LicenseType ("Professional" for Mathematica; presumably something else for Player) or the supposedly (but not really) deprecated $ProductInformation (gives "ProductIDName" -> "Mathematica" vs. "ProductIDName" -> "MathematicaPlayer"). For the CDF plugin you can check CurrentValue[PluginEnabled]. – Oleksandr R. Nov 6 '12 at 17:13 Oh, and if you want to figure out if you're running in the plugin/Player sandbox, you can use Developer$ProtectedMode for that too. –  Oleksandr R. Nov 6 '12 at 17:36
@Ajasja because all of this is undocumented and I don't have the Player installed or the time to test it properly. Whoever does and can state definitively what the results will be in various situations and for different versions of the relevant products is welcome to use my suggestions in their own answer if they wish. –  Oleksandr R. Nov 6 '12 at 19:37

As of version 10, one can use $EvaluationEnvironment returning one of the followings: "Session" local interactive session "RemoteSession" remote interactive session "CDF" standalone CDF "Script" script run in batch mode "Subkernel" parallel or grid subkernel "WebEvaluation" direct URL evaluation "WebLoad" evaluation when loading a webpage "WebAPI" API called through an HTTP request "WebForm" web form "WebServer" web server plugin (e.g. JSP) "CloudCDF" cloud CDF "PlugInCDF" CDF web plugin "Scheduled" scheduled task "WolframLink" WolframLink call  Version 9 and earlier: According to @Oleksandr's comment, I deployed the following line as a CDF file and opened it in various environments: Dynamic@{$LicenseType, Developer$ProtectedMode, CurrentValue["PluginEnabled"]}  In Mathematica 8.0.4: {"Professional", False, False}  In the CDF Player: {"Player", False, False}  Under Firefox using the browser plugin: {"Professional", True, True}  On Player Pro: {"Player Pro", False, False}  - Thanks for helping to flesh this out into a useful answer. Another thing I had been wondering is what $LicenseType is for Mathematica for Students or the Home Edition? I don't have either of these products so I can't easily check, but perhaps someone else can fill in the additional details? –  Oleksandr R. Nov 7 '12 at 8:37
Thanks @Kuba; in this case I've just found out about $EvaluationEnvironment while browsing the non-final documentation online. Many things are revealed from weak to weak as they are getting closer to roll out the new version. – István Zachar Mar 27 '14 at 14:59 The following MathLinkCallFrontEnd@FrontEndValue["$NotebookLicenseType"]