-- flag to indicate whether script has been invoked as a droplet set filecount to 0 -- run X11 if not running, then run RasMol (command shell and visualization window) on run_rasmol(filename) do shell script "open /Applications/Utilities/X11.app; export DISPLAY=:0; /usr/X11R6/bin/xterm -e /sw/bin/rasmol " & filename & " &> /dev/null &" end run_rasmol -- open subroutine invoked by OS X if we run this as a droplet (i.e. file[s] supplied) on open (filelist) repeat with filename in filelist set filecount to 1 set filename to quoted form of POSIX path of filename run_rasmol(filename) end repeat end open -- if no files supplied (e.g. user double-clicked icon) run RasMol wih no params if filecount < 1 then run_rasmol("") end if