Using ChemBioDraw as the 2D sketcher for MOE
As I mentioned in my recent review of MOE 2012 there is now support for using Marvin as an external 2D chemical drawing package, but what happens if you want to use another drawing package? Well that is where Applescript comes to the rescue, using Applescript support for shell scripts and one line of SVL (scientific vector language) we can use ChemBioDraw as the external editor.
The first part of the script checks to see if a chemical structure is selected within the ChemBioDraw application, if not it simply selects all, the next part generates the SMILES string of the selected structure.
SMILES (Simplified Molecular Input Line Entry System) is a line notation (a typographical method using printable characters) for entering and representing molecules and reactions
The next part of the script launches the X11 environment XQuartz. Then generates the shell script, that opens MOE, then uses SVL to build the molecule from the SMILES string and generate a 3D structure. many thanks to Simon at CCG for the SVL advice.
DISPLAY=:0.0; export DISPLAY;/Applications/moe2012/bin-mx86/moe -x11 -setenv smiles='" & SMILES_string & "' -exec \"sm_Build getenv 'smiles';conf_Embed3D Atoms[] \" &> /dev/null &
The last command simply runs the shellscript.

The script
--Created by Macs in Chemistry (http://www.macinchem.org) set SMILES_string to "" tell application id "com.cambridgesoft.ChemDraw" activate try if not enabled of command "copyAsSMILES" then do command "selectAll" set SMILES_string to SMILES of selection else set SMILES_string to SMILES of selection end if end try --display dialog SMILES_string end tell tell application "Finder" launch application "XQuartz" end tell tell application "XQuartz" activate end tell set shell_script to "DISPLAY=:0.0; export DISPLAY;/Applications/moe2012/bin-mx86/moe -x11 -setenv smiles='" & SMILES_string & "' -exec \"sm_Build getenv 'smiles';conf_Embed3D Atoms[] \" &> /dev/null &" --display dialog shell_script do shell script shell_script
The script can be downloaded from here Sendtomoe.scpt.zip
The Applescript section contains more tutorials, scripts and resources.