Wednesday, November 30, 2005

Chemsketch gif and name automation

From Ruslan - thanks!

This will make it much easier for people inputing info into the molecules blog.
There are still problems with generating SMILES automatically.

Install ACD/ChemBasic for ChemSketch 8.0
Save the script to a file with .bas extension
Open .sk2 file
Use File -> Run ChemBasic...


IUPAC name list generator
Code:
Function Main as String
dim x as object
dim res as string
dim i as integer
res = ""
for i=1 to ActiveDocument.Count
ActiveDocument.SetActivePage(ActiveDocument.Item(i))
For Each x In ActiveDocument.ActivePage.Diagrams
res = res + FStr(i,0,0) + " " + x.GetIUPACName + CHR(13)
next x
next i
MessageBox(res, "", MBB_OK)
End Function

GIF generator (edit line 5 before starting this script)
Code:
Function Main as String
dim dirname as string
dim x as object
dim i as integer
dirname = "d:\tmp\_\gifs"
for i=1 to ActiveDocument.Count
ActiveDocument.SetActivePage(ActiveDocument.Item(i))
For Each x In ActiveDocument.ActivePage.Diagrams
x.ExportToGIF(dirname + "\" + FStr(i,0,0) + ".gif")
next x
next i
End Function

0 Comments:

Post a Comment

<< Home

Creative Commons Attribution Share-Alike 2.5 License