How to tell if Spotfire is running from Web Player

script (versions prior 7)
from System import Environment
isWebPlayer = Environment.CommandLine.Contains("w3wp.exe")

script (vrsions 7+)
from System import Environment
isWebPlayer = Environment.CommandLine.Contains("SpotFire.Dxp.Worker.Host.exe")
#isWebPlayer = Environment.CommandLine.Contains("WEB_PLAYER")


#Optionally run this on webplayer to see what the actual command line was use to launch webplayer:
from System import Environment
Document.Properties["whatInstance"] = Environment.CommandLine 

2 comments:

Arthur said...

Code is no longer valid in Spotfire 7.6

Jose Leviaguirre said...

Arthur, you are right. The architecture on 7+ is different as it pushes the instance via node manager so the process name is different.

Did you try looking what the actual process is before checking if it contains w2wp.exe?

from System import Environment
whatInstance = Environment.CommandLine#.Contains("w3wp.exe")
Document.Properties["isWebPlayer"] = whatInstance