Difference between revisions of "OpenBabel on Windows"

From Open Babel
Jump to: navigation, search
m (Automating file conversions using Drag'n'Drop)
(Rewrote the top of the page)
 
Line 1: Line 1:
''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.''
+
''If you're looking for information on how to get Open Babel, see the [[Install]] page.''
  
== Installing Open Babel ==
+
== Overview ==
  
If you haven't already installed Open Babel, follow [[Install | this link]] to download the latest version of the Open Babel GUI.
+
Open Babel on Windows provides two programs for the price of one:
  
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.
+
* '''babel''', a command-line program for converting file formats, filtering using SMARTS strings, and so on. The Open Babel installer adds the install folder to the Windows Path. This means you can just type "babel" at the Command Prompt to run '''babel''', no matter what your current directory is.
 +
** [[Babel | Full description]]
 +
** [[Tutorial:Basic Usage | Examples]]
  
If you want to access Open Babel using the Python scripting language, you should install the Python...
+
* '''Open Babel GUI''', a graphical user interface to '''babel''''s functionality. You can start '''Open Babel GUI''' using the shortcut in the Start Menu. You can copy this onto your desktop to make it easier to access it.
 
+
** [[OpenBabelGUI | Documentation]]
== 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 ==
 
== Automating file conversions using Drag'n'Drop ==

Latest revision as of 14:49, 18 January 2007

If you're looking for information on how to get Open Babel, see the Install page.

Overview

Open Babel on Windows provides two programs for the price of one:

  • babel, a command-line program for converting file formats, filtering using SMARTS strings, and so on. The Open Babel installer adds the install folder to the Windows Path. This means you can just type "babel" at the Command Prompt to run babel, no matter what your current directory is.
  • Open Babel GUI, a graphical user interface to babel's functionality. You can start Open Babel GUI using the shortcut in the Start Menu. You can copy this onto your desktop to make it easier to access it.

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.