OSX Grid Selector Script

From OpenSimulator

Jump to: navigation, search

On OSX environments, if you have multiple viewers and multiple grids to connect to, you can try the following AppleScript (one could do something similar with a shell script). Feel free to copy and modify for your own use.

--
 --  This script selects a viewer and a grid for virtual worlds.
 --
 --
 -- Variables for the two supported viewers.  More may be added here.
 --
 set lindenViewer to "\"/Applications/SecondLife/Second Life.app/Contents/MacOS/Second Life\""
 
 set emeraldViewer to "\"/Applications/SecondLife/GreenLife Emerald Viewer.app/Contents/MacOS/GreenLife Emerald Viewer\""
 --
 -- Variables for options to select the specified grid.  Since the viewers
 -- are based on the 2nd life viewer, the options are the same for each
 -- viewer.  Also, connecting to the Second Life grid is the default option
 -- if no other options are provided.
 --
 -- Currently, four grids are supported.  More may be easily added.
 --
 set lindenOptions to ""
 
 <nowiki>set localStandalone to " -loginuri http://vw.server.lan:9000 -loginpage http://vw.server.lan/opensim/index.html"</nowiki>
 
 <nowiki>set localGrid to " -loginuri http://vw.server.lan:8000 -loginpage http://vw.server.lan/opensim/index.html"</nowiki>
 
 <nowiki>set osGridOptions to " -loginuri http://osgrid.org:8002 -loginpage http://osgrid.org/loginscreen.php -helperuri http://osgrid.org/"</nowiki>
 --
 -- Display dialog and select the viewer.
 --
 set dialogResult to display dialog "Choose viewer:
 1) 2nd Life viewer
 2) Emerald viewer:" default answer "1" with title "Select Viewer" with icon 1
 
 set option to text returned of dialogResult
 
 if option = "2" then
 	set viewer to emeraldViewer
 else
 	set viewer to lindenViewer
 end if
 --
 -- Display dialog and select the grid.
 --
 set dialogResult to display dialog "Choose server:
 1) 2nd Life grid
 2) local standalone
 3) local grid
 4) OS Grid" default answer "2" with title "Select Grid" with icon 1
 
 set grid to text returned of dialogResult
 
 if grid = "1" then
 	set options to lindenOptions
 else if grid = "2" then
 	set options to localStandalone
 else if grid = "3" then
 	set options to localGrid
 else if grid = "4" then
 	set options to osGridOptions
 else
 	set options to localStandalone
 end if
 --
 -- Combine the grid and viewer and execute the result.
 --
 set command to viewer & options
 do shell script command
Personal tools
About This Wiki