Content Scripting Python Open Web Browser
From RexWiki
Preface
This page shows how to create a script which can be used for opening webpages for the user in their external web browser.
To use this script:
- Make sure server is down
- Add the python class from below to "\rexserver\ScriptEngines\PythonScript\Samples" folder to a file named samplewebbrowser.py
- Open "\rexserver\ScriptEngines\PythonScript\Samples\__init__.py" file and add samplewebbrowser.py to the end of the list
- Start servers
- Add prim, go to it's Rex tab-> Data and add the correct parameters (see below Rex data). Remember to press the Set button below the Data to set it.
- To the same prim define "samplewebbrowser.ShowWebPage" for it's Class Name and press enter.
- Stop editing the prim.
- Touch the prim to activate the script.
Rex data for prim opening an external webpage for the user
Go to realXtend website
http://www.realxtend.org
Parameter descriptions line by line are as follows:
- Line 1: Message to show in the dialog
- Line 2: URL with the protocol in front of it, only http and https are supported
Python script
The following python script should be added to a file named samplewebbrowser.py.
import rxactor
import rxavatar
import sys
import clr
class ShowWebPage(rxactor.Actor):
def GetScriptClassName():
return "samplewebbrowser.ShowWebPage"
def EventTouch(self,vAvatar):
myfreedata = self.rexGetPrimFreeData()
paramlistlines = myfreedata.splitlines()
self.llLoadURL(vAvatar.AgentId,paramlistlines[0],paramlistlines[1])
|