Macs in Chemistry

Insanely Great Science

Applescript

Copy file to Dropbox and email link

A while back I posted a script that copied a file to a users MobilMe Public folder and created an email link to that file. With the imminent demise of MobileMe a couple of people have asked me for a script that does the same but uses Dropbox.

This script shows how to copy a file to your Dropbox Public folder and then email a link to it.

Comments

Script to email Chemical Structures

A reader commented that they often emailed ChemBioDraw .cdx structures to colleagues who it turned out did not have a copy of ChemBioDraw to view them, whilst it is possible to convert the cdx file to other formats using OpenBabel they usually just ended up exchanging an image. They asked if there was a better solution and this is an ideal task for Applescript. This script assumes the structure you want to email is open in ChemBioDraw, it will create an email using Apple Mail containing the structure as a SMILES string, and embed the .cdx file together with an image in PNG format.

Comments

KosmicTask

KosmicTask is an integrated scripting environment for Mac OS X. Whilst Mac OS X supports a number of scripting technologies either via it’s UNIX roots (Shell scripting , Perl etc.) or via Cocoa Framework Scripting using Apple’s scripting bridge (Applescript, Ruby, Python etc.) you can end up using a different script editor for each scripting language. KosmicTask allows you to script in a wide variety of languages from within a single editor. KosmicTask uses a plugin architecture that allows it to support a range of scripting languages, details of the languages supported by KosmicTask are shown below:-

KosmicTask also supports another very capable means of achieving automation - appscript. Appscript is supported by both Ruby and Python an alternative to the ScriptingBridge. 

It also allows sharing of scripts with other KosmicTask users via the local shared network.

KosmicTask

I’ve also added it to the list of Applescript Resources.

Comments

Applescript to report installed and enabled extensions

When Apple released Safari version 5 one of the most important new features was the support for extensions. Extensions are a great way to add features to Safari to personalise web browsing, they enable the addition of features that you find useful. There is a listing of Extensions that might be useful for chemists and judging by the weblogs these are of significant interest. If you are working with them however it is a bit of a pain to check which are installed and which are enabled. This applescript is a very neat way of getting a report, it also serves as a demonstration of how to link to shell scripts, in particular using the unix command cat, a standard Unix utility that concatenates and lists files, to generate the report.

Comments

ASObjC Runner released.

ASObjC Runner is an invaluable scriptable faceless background helper application. It has a dictionary with a range of commands focused on the areas where vanilla AppleScript comes up short. It adds the ability to use the power of Cocoa frameworks within Applescript.

You use it like a scripting addition, except you address the commands to the application. It provides better string handling (e.g. change case, encoding URL’s, regular expression, formatting dates), list sorting and filtering, improved file handling and progress dialog boxes.

I’ve added to the page of Applescript Resources

Comments

Scripting the Chemical Identifier Resolver Updated

I was reminded that whilst scripting menu items was the traditional way of controlling ChemDraw the more recent releases allow control by scripting commands. This is a major advance since menus can change or be translated into other languages. I’ve thus updated the script.

I was asked if it would be possible to do the same thing for other drawing packages such as MarvinSketch?

The answer is yes but because MarvinSketch does not have applescript support we have to do it slightly differently. Rather than using scripting commands we script system events to evoke the “Paste” command.

Full details of the script are here

Comments

Scripting the Chemical Identifier Resolver

The name to structure feature in ChemBioDraw is very useful but is pretty much limited to systematic names and certainly does not support other chemical identifiers like CAS Numbers. There are a number of online services that do support these sort of functions but you end up having to cut and paste from different web sites. This is where the Chemical Identifier Resolver script comes into play.

Comments

AppleScriptObjC Explored

The 'AppleScriptObjC Explored' Addenda and Errata page has been updated to cover a change made in Xcode since version 4.0 came out. <http://www.macosxautomation.com/applescript/apps/errata.html>

AppleScriptObjC Explorer v2.2 is now available. It's a free update to existing users, and incorporates all the changes in the last beta version, plus built-in updating.

Myriad Helpers 1.0.2 is now available. It's a minor update, offering a new method fordTrig: to give access to trigonometry functions. <http:www.macosxautomation.com/applescript/apps/helpers.html>

Comments

AppleScriptObjC Explored Third edition

Over the years I’ve migrated from Applescript Studio applications to AppleScriptObjC using Xcode 3 and last week I made the transition to Mac OSX 10.7.x and Xcode 4. With each transition there has been a very steep learning curve and to be honest the documentation provided by Apple has been woefully inadequate. Thankfully Shane Stanley has stepped up to the plate and provided a definitive guide for this people who want to build applications using applescript. AppleScriptObjC Explored is the definitive guide to building AppleScript Objective-C applications. It guides you step-by-step through the process of integrating the power of Cocoa into your AppleScript applets and applications, demonstrating each concept and technique in fully editable and annotated example projects.

The latest edition also includes a detailed navigation of Xcode 4, for those of us who had just learnt our way around Xcode 3 the changes made in the new version are significant and the section explaining where everything is and what they are for is invaluable, in fact it is probably worth reading this section before you start trying to write your first application.

Once you have a basic understanding of Xcode adding an interface to your script becomes largely point and click.

There is also a very useful section on trouble-shooting, and explanation of “gotchas” that will crop up occasionally.

The book comes with a collection of over 20 ready built Xcode tutorials/projects that demonstrate key implementations but that can also act as starting points for your own projects.

Whilst I keep a list of applescript resources, I suspect that AppleScriptObjC Explored is probably the most useful.

Comments

Scripting the Organic Chemistry Reference Resolver

The Organic Chemistry Reference Resolver is an invaluable web service that takes as input a text reference to a published article in a variety of formats and then finds and displays the corresponding publication.

The real beauty of a web service is that it can be accessed via a variety of means, including an applescript. This applescript uses as input either text that has been copied to the clipboard or the text the user has typed into a text box, it submits the request to the web service and displays the result in the web browser.

Comments

An alternative to the Delete Restore folder applescript

Matt over at MacOSX Tips has sent me an alternative script, in this rather than deleting the restore file it is simply enabled or disabled. This script demonstrates the implementation for Safari.

Comments

Delete Restore folders for selected applications

One of the new features in Lion is the ability of applications to resume activity at the point an application was quit. This means that when you reopen an application it will open and display all the documents you were editing in the state when you quit the application. This is obviously very useful but there are times when you may not want confidential documents automatically opened and displayed when you open an application.

This Applescript allows you to delete the restore folder for specified applications.

There are more applescripts here.

Comments

Update to AppleScriptObjC Explorer

Version 1.1.0 is now available. It includes several localizations, more frameworks, and the ability to check for and install updates. See http://www.macosxautomation.com/applescript/apps/runner.html for details.

Comments

Scripting ChemBioDraw

A script to convert .cdx to .png file format Read More...
Comments

AppleScriptObjC Explorer 2.1 released

A free update to AppleScriptObjC Explorer Read More...
Comments

AppleScriptObjC Explorer 2

AppleScript Explorer 2 has been "officially" released Read More...
Comments

AppleScriptObjC Explored

The third edition of 'AppleScriptObjC Explored' is out Read More...
Comments

ApplescriptObjC and XCode 4

AppleScriptObjC and XCode Read More...
Comments

AppleScriptObjC Explorer

A new version of AppleScriptObjC Explorer available Read More...
Comments

AppleScriptObjC Explorer

AppleScriptObjC Explorer is a script editor that takes advantage of AppleScript's ability to call Cocoa methods in OS X 10.6 and later. Read More...
Comments

AppleScriptObjC Explored Updated

AppleScriptObjC Explored has been Updated Read More...
Comments

Scripting the Script Editor

How to automate the Script Editor using Applescript Read More...
Comments

Applescript and curl

Using Applescript and curl Read More...
Comments

Myriad Helpers

More resources for applescript Read More...
Comments

AppleScritObjC Explored Updated

I’m looking at updating iBabel, to do so I need to migrate to AppleScriptObjC so I’ve been searching the Apple documentation for examples, tutorials etc. and I’ve found a pitiful amount of useful material. Read More...
Comments

AppleScriptObjC Explored

AppleScriptObjC Explored by Shane Stanley is the most advanced, thorough, and in-depth documentation for the creation of AppleScript Objective-C applications. Read More...
Comments

ChemInformatics scripts Updated

In the Applescript section there are a number of Applescripts that I use to generated calculated properties and descriptors. These make use of the cheminformatics tools provided by ChemAxon. Read More...
Comments

Applescript Resources

I’ve added Shane's ASObjC Utilities 0.9 to the Applescript Resources Page. Read More...
Comments

Rule of 7 Applescript

An applescript to generate and plot physiochemical properties It uses cxcalc from ChemAxon to generate the data and Aabel from Gigawiz to plot the results. Read More...
Comments

Applescript Resources

I’ve updated the Applescript resources page. Read More...
Comments

Programming iNMR

Programming iNMR Read More...
Comments

eMolecules Applescript

Applescript to search eMolecules Read More...
Comments

Applescript Resources

I’ve just updated the Applescript Resources Page. Read More...
Comments

Applescript and Automator

A webcast featuring Apple's Sal Sogohian. Sal is the product manager for Apple's automation products, including AppleScript and Automator. Read More...
Comments

Applescript to restart license manager lmgrd

Applescript to restart license manager lmgrd Read More...
Comments

Platypus

Added Platypus to Applescript Resources Read More...
Comments

Applescript Resources

Updated Applescript Resources Page Read More...
Comments

Applescript Resources

A few new resources. Read More...
Comments

Applescript tutorial 11, Using GeekTool

Applescript tutorial 11, Using GeekTool. Read More...
Comments

Applescript Movie

A training movie describing how to use outlets and actions to connect the interfaces of AppleScript-Cocoa applications under Mac OS X 10.6. Read More...
Comments

Applescript Resources

I’ve updated the page of Applescript Resources
Read More...
Comments

Applescript Chemistry Workflow

A chemistry workflow created using Applescript, Chemaxon tools and Aabel. Read More...
Comments

Applescript Resources

Applescript Resources for Mac OS X Read More...
Comments

Copy to mobileme

Applescript to copy a file to Mobileme and create an email message with the link. Read More...
Comments

AppleScript Language Guide Update

Well it took a while but the Applescript Language guide has been updated. Read More...
Comments

An Applescript Droplet that uses a command-line application

How to create a droplet that accesses a UNIX application. Read More...
Comments

Applescript Tutorials

Updated Applescript Tutorials Read More...
Comments

Applescript Lecture

I gave a lecture at the Scientific computing meeting at Cambridge University on using Applescript to build a User interface for Unix command-line applications. Read More...
Comments

Print Folder Contents

An applescript to print the names of all files and folders within a chosen folder (and sub-folders) using a couple of unix commands wrapped in an applescript. Read More...
Comments

Applescript Tutorial 9

Embedding chemical metadata into image files. Read More...
Comments

Applescript tutorial 8

Getting chemical structure embedded in images. Read More...
Comments

Comparing version number in applescript

Using the applescript command "considering numeric strings" Read More...
Comments

EndNote XI

EndNote has been updated to version XI Read More...
Comments

Print the clipboard

Print the clipboard directly. Read More...
Comments

Rendering chemical structures in the database

Chemical structure rendering by scripting ChemDraw. Read More...
Comments

Substructure searchable database

Creating a sub-structure searchable chemical database. Read More...
Comments

Applescript Tutorial 4 added

Latest Applescript tutorial has been added Read More...
Comments

Applescript Tutorial 3

This is the third Applescript tutorial written for MacResearch Read More...
Comments

New Applescript

Identifies potential duplicates of a file using Spotlight metadata Read More...
Comments

ChemDraw to Tiff Applescript

An applescript that converts ChemDraw structure files into TIFF format Read More...
Comments