OpenBabel on Windows
This is a place holder for the forthcoming documentation page on using OpenBabel in Windows. It will be linked to from the Install Page. It will contain links to other relevant pages, as well as Tips'n'Tricks for Windows users.
Installing Open Babel
If you haven't already installed Open Babel, follow this link to download the latest version of the Open Babel GUI.
Once downloaded, double-clicking on the installer will take you through a series of steps that installs Open Babel in your "Program Files" folder, and adds some shortcuts to the Start Menu. In addition, the Open Babel installation folder is added to the Windows Path. This means that if you open a Command Prompt, you can just type 'babel' to run the program of the same name.
If you want to access Open Babel using the Python scripting language, you should install the Python...
Using Open Babel
What's the difference between 'babel' and 'Open Babel'? Well, 'babel' is the command-line program that allows users to convert between chemical file formats, search for molecules containing a particular substructure, and so on. Open Babel is the programming library that allows all of this to happen.
In other words, 'babel' is not the only way to use Open Babel. On Windows, you can also use Open Babel by means of a graphical user interface called OpenBabelGUI, or through the Python scripting language (via the openbabel module).
- information on Open Babel GUI...
Automating file conversions using Drag'n'Drop
This section describes how automate file format conversion simply by dragging an input file onto a target on your desktop.
(1) Start Notepad, and enter the following text:
@echo off set convertto=sdf echo Converting %~nx1 to %convertto% format set outputfilename="%~ndp1.%convertto%" babel.exe %1 %outputfilename% pause
(2) Save this file on your desktop as babel2sdf.bat. Make sure that the file extension is .bat and not .txt.
(3) If you drag and drop an inputfile onto babel2sdf.bat, babel will create an SDF output file of the same name. The output file will be created in the same directory as the inputfile.
(4) If you don't like 'pressing any key to continue', remove the "pause" line in babel2sdf.bat.
(5) It may be more convenient to have a copy of the bat file in the folder where your chemical files are. Dropping a chemical file on the bat file still works in all Windows Explorer modes - including Details, List, Icons, etc.
(6) As an alternative to (1), use just a single line of text:
@babel.exe %1 "%~ndp1.%~n0"
and save it as sdf.bat. This will behave the same as babel2sdf.bat above. But, if you copy it and rename it cml.bat, it will convert dropped files to Chemical Markup Language instead. Similarly with any other OpenBabel format.