PerkinElmer Informatics Support Forum
Decrease font size
Increase font size
Topic Title: Applescript to Export from ChemBioDraw as a mol file
Topic Summary: Applescript to Export from ChemBioDraw as a mol file
Created On: 12/10/2013 11:10 PM
Status Post and Reply
Linear : Threading : Single : Branch
Topic Tools Topic Tools
View topic in raw text format. Print this topic.
 12/10/2013 11:10 PM
User is offline View Users Profile Print this message


BrianMyers

Posts: 5
Joined: 9/21/2009


I recently created an Applescript to Export a selection from ChemBioDraw as a mol file. One of the issues I have is that the mol file contains in its first line the incorrect name of the file. It should be the same as the dialog. I am unsure how to set this property via applescript. I also know/feel there is a bug in the routines used in ChemBiodraw to create a mole file. this has been submitted to support; however, I am wondering how one could set the properties of the file or strip out the first line of the text file and replace it with the name that has been created for the file.

The mol file format is a very well established format, it has the advantage of being a human readable text format so if nothing else you can open and read them in any text editor. For more information and for access to the Applescript, see Chris Swain's Macs in Chemistry webpage on the Applescript I created (using other examples he had posted): http://www.macinchem.org/applescript/exportAsmol.phphttp://www.macinchem.org/applescript/exportAsmol.php

-------------------------
Brian J. Myers, Ph.D.
Associate Professor
Department of Chemistry and Biochemistry
Ohio Northern University
 12/11/2013 12:32 PM
User is offline View Users Profile Print this message


drc007

Posts: 46
Joined: 10/5/2009

Actually if you simply save as a mol file from within ChemBioDraw and look at the file in a text editor as you can see below the title seems to be set to the chemdraw template name.

Untitled My_template-1
ChemDraw12111317222D

6 6 0 0 0 0 0 0 0 0999 V2000
 12/11/2013 2:51 PM
User is offline View Users Profile Print this message


BrianMyers

Posts: 5
Joined: 9/21/2009

True, but if you have many of these in sequence that you need to save you will see the problem:

Draw the structure of toluene
Choose File--> Save As
Select MDL Molfile
Name the File Toluene.mol
Save
Modify the structure (to ethyl benzene)
Choose File--> Save As
Select MDL Molfile
Name the File EthylBenzene.mol
Save to Desktop
Open the two mol files in a text editor
Note:
1) the first line of the Toluene.mol is "Untitled ACS Document 1996-1"
2) the first line of the EthylBenzene.mol is Toluene.mol

The above has been submitted to support. I was just posting here upon their suggestion to make people aware of the script and to see if their was a quick work around for setting the property.

-------------------------
Brian J. Myers, Ph.D.
Associate Professor
Department of Chemistry and Biochemistry
Ohio Northern University
 12/12/2013 10:54 PM
User is offline View Users Profile Print this message


Sue

Posts: 232
Joined: 8/17/2009

Dear Brian,

Please have a look at the title of your document. When you just launched your ChemDraw application, or created a new document, the title would be “Untitled ****”, such as "Untitled ACS Document 1996-1". When you save it as Mol file, its header block will inherit the current document title "Untitled ACS Document 1996-1". So, if you want it to be your current molecule name, I am afraid you need to save it as Mol file again after your rename it.

-------------------------

- PKI Support
 12/13/2013 8:50 AM
User is offline View Users Profile Print this message


BrianMyers

Posts: 5
Joined: 9/21/2009


Thanks for the reply. I see that it is picking up the header from the open file. But why is it not picking up the information for the header of the file from the Save as dialog box?

This issue is being looked at by support: CAS-669283-0S9JZM - FW: Save Selection as Mol File Applescript CRM:03671128

My reason for posting here was to see if anyone was aware of a method on how to set the header of the mol file while saving using my Applescript without using another application like BBEdit or TextEdit.





-------------------------
Brian J. Myers, Ph.D.
Associate Professor
Department of Chemistry and Biochemistry
Ohio Northern University
 12/18/2013 2:35 PM
User is offline View Users Profile Print this message


drc007

Posts: 46
Joined: 10/5/2009

Originally posted by: Sue
Dear Brian,

Please have a look at the title of your document. When you just launched your ChemDraw application, or created a new document, the title would be “Untitled ****”, such as "Untitled ACS Document 1996-1". When you save it as Mol file, its header block will inherit the current document title "Untitled ACS Document 1996-1". So, if you want it to be your current molecule name, I am afraid you need to save it as Mol file again after your rename it.

-------------------------

- PKI Support

I just tried saving as a mol file and then saving again. The title does not change unless you quit ChemDraw and then reopen and save.
 12/19/2013 2:37 AM
User is offline View Users Profile Print this message


Sue

Posts: 232
Joined: 8/17/2009

Yes, it will still inherit the original title if you just saved it twice continuously, without modifying it.

-------------------------

- PKI Support
 1/25/2014 5:03 AM
User is offline View Users Profile Print this message


drc007

Posts: 46
Joined: 10/5/2009

Hi,

The script has been updated

Link to page

Adding

do menu item "Clean Up Structure" of menu "Structure"

Effectively "updates" the file, the title is then updated as desired.

FuseTalk Basic Edition v4.0 - © 1999-2019 FuseTalk Inc. All rights reserved.