Augmented reality is finding new applications in science, in particular the ability to enhance publications or lecture notes, and viewers can set up a free account with Augment to provide easy access.
I was asked recently if it might be possible to generate an AppleScript droplet that you could simply drop a chemical structure file onto to generate the desired files needed for the Augment, and this is an ideal use case for a droplet.
This script uses Jmol to generate the Wavefront .obj and .mtl files which can be used
You read more about the script and download it here.
A new version of Script Debugger has been released.
Script Debugger is an integrated development environment focused entirely on AppleScript. This focus allows it to deliver a suite of tools that make AppleScript development amazingly productive. You can use it to write and edit code, analyze target applications, debug scripts, and more.
Some time ago I published an AppleScript that allowed users to make use of the excellent Organic Chemistry Reference Resolver.
The Chemistry Reference Resolver serves to quickly direct you to a publisher's webpage that contains the article you are looking for: You type-in the reference The Resolver determines whether it is a journal citation, a DOI, a Sigma-Aldrich chemical search, or something more esoteric Based on the input, it then redirects you to the publisher's webpage – straight to the paper (or its nearest approximation) Many formats are supported including vaguely defined "lazy citations", such as "perkin1 2002 2733".
I was really delighted to hear recently that Brian Myers had customised the script to fit in better with his workflow. Simply copy the reference text to the clipboard and when you activate the script you can search for the reference immediately. Both versions of the script are available here.
Anyone who has touched upon scripting/automation on the Mac will no doubt have heard of Sal Soghoian so when I got this message recently I thought I'd better pass it on.
Sal here, with something pretty cool to share with you. We’ve started a new conference to bring together the Apple automation and scripting community!
The conference is called CMD-D (pronounced “Command-D”), and it will be held August 9th at the Santa Clara Convention Center. It’ll be a full day of exploring the current state of automation technology on both Apple platforms, sharing ideas and concepts, and showing what’s possible—all with the goal of inspiring and furthering development of your own automation projects. To assist in this exploration of all things Automation, I’ve invited some of my smartest friends to present sessions focused on their own areas of automation expertise, on macOS and iOS. And, for those new to automation, we’re also planning a Scripting Boot Camp on August 8th. I’m really excited about CMD-D. Finally, the Apple automation community has its own conference. If you use automation, create automation or develop software, this is your conference too.
Registration for CMD-D is open now! http://www.cmddconf.com.
I just noticed that the AppleScript Library Myriad Tables has been updated, Myriad Tables Lib is an AppleScript script library that gives AppleScript scripts the ability to show dialogs containing tables. It requires OS X 10.10 or later. This is just one of the great resources available from Mac OS X Automation
- ASObjC Runner is a scriptable faceless background helper application. It has a dictionary with a range of commands focused on the areas where vanilla AppleScript comes up short. 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.
- ASObjCExtras is a free framework that fills in some of the gaps in AppleScriptObjC support, as well as providing some useful extra facilities including methods for efficiently processing lists and strings.
- Myriad Tables gives AppleScript scripts the ability to show dialogs containing tables.
- CalendarLib_EC an AppleScript script library for manipulating calendar events without using Calendar.app.
- DialogToolkit an ASObjC-based script library for showing enhanced dialogs.
- Myriad Helpers is a collection of Objective-C files that simplify some of the coding involved in AppleScriptObjC.
In addition there is also Everyday AppleScriptObjC the absolutely essential guide for anyone who wants to explore the full power of AppleScriptObjC.
For more information have a look at the AppleScript Resources Page.
Brian Christmas has compiled an absolutely invaluable list of tips and samples of code for those using AppleScript or AppleScriptObjC. He has kindly allowed me to host a page containing all these tips
This list is a great resource for those just starting out but will also be invaluable for more experienced scripters.
If you would like to contribute probably the best way is to subscribe to one of the Apple mailing lists
There is a page of other AppleScript Resources here.
ASObjC Explorer has just been updated to version 4.1.17, with fixes relating to Sierra. Choose 'Check for Updates...' to update.
Note also that ASObjC Explorer is no longer available for general sale. Barring bug-fixes, this is the last release -- there will be no further development. You can read more here:
Registered users are eligible for a 50% discount on Script Debugger 6 until mid-November as compensation, and should email Shane Stanley for details.
Development of Script Debugger 6
Its AppleScriptObjC code completion will be familiar to users of ASObjC Explorer, but goes further. And Script Debugger 6 ability to step through scripts and explore Cocoa results, to the point of being able to explore the contents of collection classes.
@MatToddChem recently tweeted
Chemdraw file containing lots of molecules --> separate png/jpg images of each molecule. Anyone got a script that automates that? #headache
Whilst it is possible to convert a ChemDraw file to an image the problem is you get a single png file containing all the structures. In order to get individual image files it is first necessary to separate the individual structures. The easiest way to this is to convert from cdx to SMILES format. We can then take each of the individual SMILES strings and generate an image using OpenBabel all controlled by an Applescript.
Just got this email.
A major update of ASObjC Explorer, version 4.1, is now available, just in time for the holiday season. This version incorporates a new and improved logging engine, incorporating extended AppleScript syntax styling and now resolving Cocoa objects -- no more will you have to deal with «class ocid» id «data optr000...» entries. ASObjC Explorer is the editor for Mavericks and Yosemite users wishing to write ASObjC code. You can read more here: http://www.macosxautomation.com/applescript/apps/explorer.html. You can also download it and try it out free for 30 days. To celebrate, you can use the coupon code NEWLOG to receive a $US10 discount between now and the end of January. Ho, ho.
New version for Yosemite and Mavericks users
ASObjC Explorer 4 is a script editor built to take full advantage of AppleScript’s ability to call Cocoa methods. With AppleScriptObjC-based libraries available in Mavericks and Yosemite, and now direct access to AppleScriptObjC code in Yosemite, ASObjC Explorer 4 can help you write and debug your code more quickly, more effortlessly, and more efficiently. It also makes a great external editor for those developing in Xcode.
ASObjC Explorer lets you write your code, write separate testing code, step through your code, log what happened, and even add scripting terminology — all in one document window. When you have finished, you can use your document as a script or library, or export to your favorite format, including Mavericks-compatible applets with embedded script libraries.
Yosemite catches up to 'Everyday AppleScriptObjC'
Myriad Communications pleased to announce the availability of the second edition of 'Everyday AppleScriptObjC', updated for both Yosemite and Mavericks.
Yosemite confirms AppleScriptObjC's position as an important component of AppleScript, giving access to the Cocoa frameworks and their functionality wherever scripts are run. It is now truly an "everyday" option.
'Everyday AppleScriptObjC', Second Edition, provides an introduction to using the Cocoa frameworks from a scripter's point of view. It covers writing the code, in both Mavericks and Yosemite, as well as deployment issues.
The book has been updated to cover Yosemite, as well as to expand coverage in other areas. It is full of usable code snippets, which are also provided in file form in both Mavericks and Yosemite formats.
'Everyday AppleScriptObjC', Second Edition, is by Shane Stanley, author of 'AppleScript Explored', the guide to using AppleScriptObjC in Xcode. You can find out more here:<http://www.macosxautomation.com/applescript/apps/everyday_book.html>. It is available now for $US14.95.
Applescript has had to take a bit of a back seat in recent years but there have been a couple of posts recently that will be of significant interest to all scripters.
The latest beta version of Papers for Mac adds support for scripting. This allows you to automate tasks or fetch and manipulate data in your Papers library by using AppleScript, or JavaScipt in Yosemite. Papers 3 features extensive AppleScript support that allows data to be fetched from a Papers library. You can also execute commands, like import and export. You can even create new data and set its most important properties. Some parts of the UI can be automated as well: the current selection can be changed, as well as the current view mode.
The importance of adding Applescript support to applications is nicely illustrated in an article by Brent Simmons, Making Your Mac App’s Data Scriptable.
Scripting isn’t a matter of automating button clicks; it’s about exposing the model layer to people who could use your app in their workflows.
There have been many concerns that the introduction of “sandboxing” will compromise the ability of applescripts to automate complex multi application workflows. There has been a recent article that shows the current best practices for controlling another app using AppleScript, Scripting from a Sandbox.
This comment sums things up nicely
While that’s usually a small minority of users (who use applescript), they’re power users — the kind of people who recommend apps to friends and family. They blog and tweet about apps, and people listen to them. They can be your app’s biggest evangelists.
And of course it is easy to share applescripts. I’ve added the links to the Applescript Resources page.
ASObjC Explorer for Mavericks
Changes from version 3.2.0 to 3.2.2
Code-completion enhancements. Code-completion has been enhanced for relevance. As part of this, Explorer supports new variable-naming conventions. Please read the section entitled 'Contextual Completion' in the Help file for more details.
Bug fix. Choosing 'Look Up in AppKiDo' from the contetual menu in the Library Pane erroneously entered the resulting script in the log. This no longer happens.
Sparkle update. A newer version of the Sparkle update framework is included. If you choose automatic updates, they should now happen automatically.
Updated scripts and user shortcuts. You can extract these from the application's bundle, or remove the existing ones and relaunch the application to have them instlled automatically.
Updated example scripts. These have been updated to reflect the new variable naming conventions
Version 3.2 of ASObjC Explorer for Mavericks, the script editor built to take full advantage of AppleScriptObjC, is now available.
The two main new features are Apple event logging, similar to tradition AppleScript editor logging, in addition to Explorer's own logging; and the ability to specify which thread scripts are run on, to facilitate debugging of scripts that use callbacks and times.
There are also a raft of scripting changes, several extra sample scripts, and improvements in several other areas.
You can read more here:
As Apple provide ever improved means to build fully fledged applications using Applescript the documentation from Apple has become ever more outdated. Fortunately Shane Stanley has continued to update his absolutely essential book AppleScriptObjC Explored. I started building applications using AppleScript Studio, but with Mac OSX 10.6 we gained a new framework AppleScriptObjC. AppleScriptObjC was a new framework in OS X v10.6 that allowed Cocoa applications to be written in AppleScript. Using AppleScriptObjC AppleScript code can work with any Cocoa framework, and can function as a first-class citizen in the Cocoa world. It also brought scripters into contact with Xcode. This daunting transition may have left many of us floundering if it was not for this book.
The Fifth Edition of the definitive guide to building AppleScript-Cocoa applications in Xcode is now available, covering Mavericks and Xcode 5. Mavericks introduces new syntax specifically for AppleScriptObjC projects, and the book and accompanying projects have been fully revised to cover this, as well as the important changes in Xcode 5.
Whilst the book is excellent, what I’d like to highlight however are the sample projects, these are 20 fully-editable and annotated example projects that you can explore and modify.
This is the definitive guide and should be on every scripters bookcase.
There is more information on the Applescript Resources Page.
Apple has released updates to their iWork productivity suite, perhaps most interestingly Numbers now regains applescript support. If you open the Applescript dictionary most of the classes and commands are now available again, still absent are “split into columns” and “split into rows”.
The mobile version of Numbers for iOS has also been updated.
I’ve added a minor update to the Export as mol file script.
One of the issues with the original script that the mol file contains in its first line the incorrect title of the file (it appears to be the name of the document template).
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-2”.
Untitled ACS Document 1996-2 ChemDraw12201318592D 14 16 0 0 0 0 0 0 0 0999 V2000
It would be better to have the molfile title the same as the file name the user enters in the dialog box, one way to achieve this is to “edit” the file and then save again to the same file name. We can do this by adding a line to clean up the structure and then saving.
save first document in (molAttachment) as "MDL Molfile”
--This is to ensure the title of the mol file is set correctly
do menu item "Clean Up Structure" of menu "Structure"
save first document in (molAttachment) as "MDL Molfile"
close first document saving no
If you now look at the mol file in a text editor you can see the title is set more appropriately.
Mol file1.mol ChemDraw12201319082D 14 16 0 0 0 0 0 0 0 0999 V2000
A number of publishers are seeking to add extra value to publications by including access to chemical structure information to aid searching and indexing. More details are included in this comment from Elsevier.
Elsevier would like to enrich online articles by visualising and providing details of chemical structures you define as the main chemical compounds described in your article. For this purpose, mol files of the key compounds can be uploaded in EES. Please use your preferred drawing tool to export chemical structures as mol files and ensure that they are well defined and do not contain aromtic bonds, R-Groups or other variables. Submitted mol files will be available for downloading from your online article on ScienceDirect. Furthermore, Elsevier will generate InChI keys from the mol files and include them in the online article, which increase the online searchability of your article e.g. in Google. InChI keys will also be used to link the article to additional data in Reaxys.
Since you need to export each structure as an individual file this will become somewhat tedious, fortunately Brian Myers has written an applescript that greatly helps the process for ChemBioDraw users
I just saw this message from Shane Stanley
As some of you have probably found already, Xcode does not recognize AppleScript's new interleaved syntax when used for action handlers -- you cannot make connections to them from controls. The workaround is to keep using the underscore syntax for action handlers until the problem is resolved. That's not ideal if you use an external editor, though. FYI, I've just released a new version (3.0.7) of ASObjC Explorer for Mavericks to deal with this issue. There is a new preference setting in Preferences -> Other. When checked, every time you save a .applescript file, any single-argument handlers will be changed to use old-style underscore syntax. (The new syntax will appear in Xcode and in the saved file, while the new syntax will still appear in Explorer.)
One of the big changes with Mavericks is the enhanced security and this has an impact on all developers even those who write a “simple” applescript to avoid a tedious or repetitive series of actions.
Developers have often relied upon AppleScript’s ability to control the user-interface, to provide an automation solution when no direct scripting support of an application or process was available. While this valued ability continues to be fully supported in Mavericks, the enhanced security focus of the new OS requires a few changes in how scripters access and apply the Accessibility frameworks.
There is a really comprehensive discussion of Accessibility Preferences and GUI Scripting over on Mac OS X Automation. Well worth a read.
Myriad Communications has released its successor to AppleScriptObjC Explorer, available immediately. The new editor takes advantage of the improvements to AppleScript in the latest release of OS X, which make access to Objective-C frameworks from AppleScript easier than ever.
"The changes to AppleScript in Mavericks have largely flown under everyone's radar, but script libraries open lots of doors for scripters," says the application's developer, Shane Stanley. "Bridging between AppleScript and Objective-C code has become much easier. This sets a new direction for expanding AppleScript's abilities."
ASObjC Explorer for Mavericks is designed to make developing AppleScriptObjC-based script libraries simple, with everything you need in one window. It features customised syntax formatting to take advantage of the new interleaved syntax; intelligent code-completion and shortcuts to take the tedium out of entering code; logging, stepping and breakpoints to aid in debugging; and a built-in simplified scripting-definition editor for adding English-like terminology.
It also makes an ideal external editor for AppleScriptObjC-based Xcode projects in Mavericks
ASObjC Explorer for Mavericks can be downloaded from <http://www.macosxautomation.com/applescript/apps/explorer.html>, and can be used free for 30 days. The purchase price is $US49.95.
For further inquiries, contact Shane Stanley at <firstname.lastname@example.org>.
I’ve just updated the Applescript Resources page, in particular I’ve included updates to the great tools provided by Satimage-Software. These include Smile a programming and working environment that you can use in a variety of situations. You may want to perform a scientific work, to handle cgi requests, to automate an intensive file processing task, to produce computed graphics, to edit XML files, to work with Unicode texts, to make GUI of your scripts, and SmileLab the SmileLab license adds the data visualization features to Smile, the automation environment by Satimage-Software.
In SmileLab you can
- extract data from files (default data formats supported: text, binary, FITS, XNF, ...),
- perform data processing using commands provided with Smile or controlling external code
- visualize your data in the most usual forms (curves, scatter plots, bar graphs, contour lines, color maps and vector fields in 2D, and 3D surfaces),
- customize the interaction of the user with the plots (handling mouse clicks, contextual menus, keyboard events...) and create custom interfaces,
- export your plot as a PDF file, as a bitmap picture (PNG, JPEG, TIFF, BMP, PSD) or as a QuickTime movie.
Recently there has been an increased use of JSON format for data exchange.
JSON is built on two structures
- A collection of name/value pairs. In various languages, this is realised as an object, record, struct, dictionary, hash table, keyed list, or associative array.
- An ordered list of values. In most languages, this is realised as an array, vector, list, or sequence.
JSON can be used to provide the results of a calculation via a web service or it could be used to provide the results of a database search, indeed the popular database mongoDB uses JSON-style document storage. It can be regarded as less verbose alternative to XML.
I just noticed that there is now an Applescript parser for JSON,
I’ve added JSON Helper to the Applescript resources page.
Un1Chem is a new web resource provided by the EBI, it is a 'Unified Chemical Identifier' system, designed to assist in the rapid cross-referencing of chemical structures, and their identifiers, between databases. Currently the uniChem contains data from 19 different databases:-
Since ChemBioDraw can generate InChi Keys I thought it might be interesting to write an applescript that access this service. The InChIKey is a short, fixed-length character signature based on a hash code of the InChI string. By definition, hashing is a one-way conversion procedure and the original structure cannot be restored from the InChiKey allowing confidential searching.
If you are looking for an alternative to Script Editor then Script Debugger might be worth a look, and it has just been updated.
Script Debugger 5.0.6 is a free maintenance release addressing a series of issues that came to light following the release of Script Debugger 5.0. This maintenance release makes Script Debugger fully compatible with Mountain Lion (Mac OS X 10.8.2) and addresses a number of stability and performance issues.
There are more useful tools on the Applescript Resources page.
Platypus is a developer tool for the Mac OS X operating system. It creates native Mac OS X applications from interpreted scripts such as Applescript or shell scripts, or Perl, Ruby and Python programs. This is done by wrapping the script in an application bundle along with a native executable binary that runs the script.
The update includes
- New "Prompt for file on launch" option
- Redesigned Drop Settings sheet
- Fixed issue where version would not appear in Get Info in Finder (missing CFBundleShortVersionString)
- Generated apps have NSHumanReadableCopyright defined again
- Extensive updates to documentation
- "Provide as a Mac OS X Service" no longer enabled by default
- Removed all support for file types. They are ancient crust now mostly ignored by Mac OS X and should no longer be used.
- Improved uninstall script
- Fixed issue where a generated icon file referenced in a Profile could be overwritten
- Documentation files now open in default browser, not in default .html handling app
- Fixed broken nib optimization. Platypus now correctly detects XCode 4 installs.
There are a number of other tools on the Applescript resources page.
There have been a number of discussions about the impact of sandboxing on Appelscript, the latest update (10.8) helps to clarify the situation.
Sandboxing and Running Scripts
Sandboxing your application may require changes to how it runs scripts. The usual method in the past has been NSAppleScript, but since scripts typically rely on sending Apple events and the default sandbox profile does not allow sending Apple events to any other application, this often does not work correctly when in a sandbox. Scripts run from your application will fall into one of three categories: • Self-targeted scripts. Your scripts only send events to your application and never to any other application. Continue to use NSAppleScript as before. • Built-in scripts. Your scripts are built as part of your application, and will not change after shipping. Continue to use NSAppleScript, but add entitlements for sending events to the target applications. • User scripts. Your scripts are supplied by the end user, and may use any other application. Use NSUserScriptTask. The scripts must be stored in a special location (use NSApplicationScriptsDirectory to determine where), and will run outside of your sandbox.
Sandboxing and Scriptability
Sandbox policy does not restrict receiving of Apple events, so in general, your application’s scriptability code will not be affected by sandboxing. Note: As mentioned under Compatibility above, sandboxed applications will not be able to access files referred to in commands using a string path. Any parameters or properties in your application that refer to files should be declared as type file, and not type text. Apple Event Manager will add sandbox extensions to events that have file-like parameters, but only if the parameter is of a recognized file-like type: typeAlias, typeFileURL, cFile, and so on. Without these extensions, the file will not be accessible from the target application’s sandbox, and the command will probably fail.
Your application’s scripting definition (sdef), however, should be updated to add access groups: groups of commands, classes, and so on that a sandboxed client can request to use with the new com.apple.security.scripting-targets entitlement. For example, Mail defines a “compose” access group that allows creation and editing of an outgoing message, but nothing else. This is safer than the old com.apple.security.temporary-exception.apple-events entitlement, which allows access to the entire scripting interface. See sdef for details of the markup format.
With WWDC about to open tomorrow I’ll be looking with interest to see if there any changes to Applescript and AppleScriptObjC.
I thought I’d also mention AppleScriptObjC Explored the book by Shane Stanley, this is the definitive guide to creating AppleScript Objective-C applications, and until Apple improve the documentation this is essential reading.
There is a list of Applescript resources here.
A while back I got this question
”I’m about to hit the tedious part of writing my chemistry PhD thesis in Microsoft Word: having all mentioned compounds numbered in text and in the chemdraw imported files. My question: is there any automated option for this task or do I have to insert every number manually? In particular renumbering after adding a new compound in the middle of the text”
There are a couple of ways to do this in LaTex (http://www.jkwchui.com/2010/03/writing-chemistry-with-latex-33/) and (http://piti.exroot.org/konwerter/) but in my experience LaTex is not particularly popular among chemists. However help is at hand, I’ve just been sent details of a brilliant applescript that works with ChemBioDraw and Word.
The process is described in detail here (http://www.martinp23.com/blog/2013/03/chemdraw-and-word-compound-numbering-on-mac/) so I won’t give anymore details just to add that one thing I’ve been using in recent Chemdraw scripts is
tell application id "com.cambridgesoft.ChemDraw"
It avoids the problems with application naming with different versions of Chem(Bio)Draw Std/Pro/Ultra.
There are many more applescripts here.
I’ve just added Chartsmith to the list of data analysis tools.
Chartsmith is the premier charting and graphing application for Mac OS X. Built from the ground up on Mac OS X technologies, this application will make you and your data hum. Whether for scientific data visualization, for business presentation, or for graphics publishing, Chartsmith makes charting and graphing quick and easy.
Chartsmith supports a variety of chart types and can import from Excel or ascii text files. There is also Applescript support for automating workflows.
There is a comprehensive listing of data analysis tools for Mac OS X here.
AppleScriptObjC Explorer is a script editor that takes advantage of AppleScript’s ability to call Cocoa methods in OS X 10.6 and later. AppleScriptObjC — AppleScript with the added ability to call MacOS X’s Objective-C-based frameworks using AppleScript syntax.
New in AppleScriptObjC Explorer 2.5.0
- Script stepping. You can now step through scripts a statement at a time using new Step, Resume and Resume to Selection commands.
- Updates to exported apps. Exported apps get individually named executables, plus correct name in their application menus.
- Bug fixes. Fixes to compiling, saving as .applescript files, and logging time-stamps.
There more details on the Applescript Resources Page.
I had an interesting email from Geoff Hutchison who is using an iPad mini for taking notes using Notability the notes can be typed, handwritten using a stylus, or images. Notability does not export directly to Evernote an app that can capture and synchronise notes between multiple platforms including iPad and desktop. The other feature that makes Evernote interesting is it provides handwriting recognition, thus making the handwritten notes text searchable.
Geoff had a Automator service that imported the Notability notes that had been saved to Dropbox into EverNote, however he wanted a better way to name the notes created in Evernote. As it turned out the best way to do this was to use Applescript, you can read the full details here.
Script Debugger 5.0.5 is a free maintenance release addressing a series of issues that came to light following the release of Script Debugger 5.0. This maintenance release improves compatibility with Mac OS X 10.8 by introducing support for bundle IDs in applets and droplets.
There are details of more Applescript tools in the Applescript Resources
I use Moe for molecular modeling work, this uses a license.dat file in each installed MOE root directory that must be updated with the contents that you have been given by CCG (either by hard copy or e-mail). You can use any ASCII text editor (I used BBEdit) to edit the file. The FlexLM license manager lmgrd must be configured and run. Usually this runs quietly in the background and needs little intervention, however I've found that on some occasions the server quits (perhaps after updates) and needs to be restarted. However since it is something I don't need to do regularly I always spend a while working out the exact syntax. So I created this short Applescript to restart the server. Each time MOE gets updated you need to change the folder path, and I’ve updated the details to reflect this.
As I mentioned in my recent review of MOE 2012 there is now support for using Marvin as an external 2D chemical drawing package, but what happens if you want to use another drawing package? Well that is where Applescript comes to the rescue, using Applescript support for shell scripts and one line of SVL (scientific vector language) we can use ChemBioDraw as the external editor. Full details of the script are here.
The Applescript section contains more tutorials, scripts and resources.
PublishPlot has been updated and is now available from the Mac App store, it is a very handy tool for creating publication quality plots from any text based table of data.
PublishPlot is scriptable using either Applescript or Python.
New in version 1.1 is a tool bar to display x,y location when hovering over a plot, new fitting options and the ability to apply mathematical transforms to any two curves. There are also new export functions and bug fixes.
PublishPlot is included on the page of data analysis tools
EventScripts is a simple application for triggering AppleScripts or shell scripts whenever certain events occur.
The listing of events a quite comprehensive and includes such things as Volumes mounted or unmounted, computer wakes, screenshot taken application launched etc.
Now added to the Applescript Resources Page.
The fourth edition of AppleScriptObjC Explored, the indispensable reference to AppleScriptObjC, is now available, this guide written by Shane Stanley is absolutely essential for anyone wanting to access the Cocoa frameworks from Applescript.
Since the release of the third edition there have been significant changes to Xcode, and subsequently how applications are developed. Unfortunately, but inevitably, things have become a bit more complicated.
The new edition covers the changes that have been introduced in Xcode 4.4 and later, as well as in OS X 10.8, plus other new material and projects.
Changes include new projects covering drag-and-drop in tables and making an application scriptable, plus an expanded Xcode section with a subsection on mastering build settings. There are also several new chapters in the Reference section. Code for more than 25 projects is included.
The price is $29.95 and there are upgrade options for previous purchasers.
A really great book I’ve added to the AppleScript resources page.
I’ve just come across this fantastic AppleScript Library a collection of invaluable scripts and routines to make up for missing standard functionality. Currently there are libraries available for string manipulation, a files and folders library, iWork, a URL library and a number library.
A really great resource I’ve added to the AppleScript resources page.
I’ve just come across another site providing applescripts, Macscripz.
MacScripz are just really simple scripts. They basically function as tweaks to your system. A script can range from simply deleting a file in your OS to altering a previous setting. What most scripts on this site will do is change a setting set by Apple initially to change a core behavior on your system. For example, the tweak Cloak&Dagger forces Finder (on OS X 10.7 and up) to display files Apple hides from its users. Every script on Scripz.com is pre-screened, so don't ever worry about harming your system with any of our tweaks, we only upload quality content.
I’ve added it to the Applescript Resources Page.
Script Debugger 5.0.3 is a free maintenance release addressing a series of issues that came to light following the release of Script Debugger 5.0. This maintenance release makes Script Debugger fully compatible with Mountain Lion (Mac OS X 10.8) and addresses a number of stability and performance issues.
Bugs closed in the 5.0.2 release:
- 17584 Resolved a crash that can occur when closing a paused document with leaked resources (e.g. unclosed files opened with the ‘open for access’ command).
- 17570 The Recompile command is once again operational.
- 17565 Corrected a problem where Script Debugger would not quit if the top window is an Event Log window.
- 17489 Resolved a problem where Script Debugger would crash opening multiple document tabs on 10.6.4 systems.
- 17548 Resolved a crash that happens when the event log window is opened, closed, reopened and then closed while the document remains open.
- 17528 Script Debugger reopens scripts in their tabs rather than in separate windows following a crash.
- 17521 Corrected a problem where text selections may not be drawn properly following a Replace All operation.
- 17512 Resolved a problem where Script Debugger may report a parameter error (-50) when a script stops on 10.6.4 systems.
- 17517 Improve the presentation when confirming document saving while closing a window with multiple dirty tabs.
- 17487 Libraries added from the Application Support folder now default to ‘Relative To Application Support’.
- 17480 Resolved a problem where Script Debugger crashes when launched on 10.6.4 systems.
- 17505, 17543, 15974 Resolved a series of memory related bugs that may improve overall stability.
- 17494 Improved performance when opening and compiling longer scripts.
There is a page of applescript resources here.
AppleScriptHTML coverts AppleScript source code to HTML representing styles and formatting.
AppleScriptHTML's features. * Clean HTML * Styles are applied by Cascading Style Sheets. It is easy to customise styles after HTML generation.
- Script Link
- Can adding a link to open the AppleScript code in AppleScript Editor. This function is useful for displaying sample codes
In version 2.4, the support of inline css is added.
Script Debugger an advanced script editor has been updated.
Improved Inline Find & Replace
Inspector Window and Result Drawer Unification
Script Debugger 5.0 combines Script Debugger 4.5′s various floating inspector panels and its Result drawer into three ‘tabs’ displayed along the right-hand side of each document.
New Bundle Editor Script Debugger 5.0 offers a new bundle editor where you can manipulate the resources contained within a bundled script or a script application.
Floating Mini Debugger This new window floats above all your applications.
New Value Explorer A central feature of Script Debugger is its value Explorers which let you inspect values. For Script Debugger 5.0, value Explorers have been completely re-implemented and simplified. The result is a much more powerful and efficient tool for examining values and exploring the objects and properties offered by the scriptable applications that you control in your scripts.
Element Filtering Script Debugger 5.0’s new Scope Bar lets you remove unwanted information from Explorers. For example, unselecting the ‘Empty Elements’ filter removes empty elements from the Explorer’s display.
Improved Handling of Large Element Collections Script Debugger 4.5 could slow down when displaying large element collections, such as the rows in a database. Script Debugger 5.0 avoids this problem by initially displaying only the first 30 rows. Data is then retrieved from the application for only those rows visible in the Explorer. Other rows are read only when they are scrolled into view. Press the new show more button to view additional rows.
New Apple Event Log Script Debugger 5.0 introduces an entirely new Apple Event Log which is integrated directly into the script window.Apple Events are now retained even when the log is not visible, allowing you to look at the event log without having to plan ahead. Additionally, you can change formats (source, raw, AEPrint) on the fly without having to re-run your script.
Explorable Local Variables When stepping through handlers, local variables containing object references can be explored in Script Debugger 5.0. Additionally, object references passed into handlers can show the target application.
Conditional Breakpoints Script Debugger 5.0 lets you assign conditions and actions to breakpoints.
Separate Running & Debugging Toolbars Script Debugger 5.0 offers two toolbar configurations: one for when debugging is disabled; and another for when debugging is enabled. You can customize the toolbar based on how you are using Script Debugger 5.0.
Script Debugger 5.0 improves its object model diagrams by showing element (one-to-many) relationships, and property (one-to-one) relationships.
Improved Spotlight Indexing
Fully 64-Bit Native
As part of my day job I maintain Drug Discovery Resources a website intended to act as a resource for scientists undertaking drug discovery. One part of the site has a section on bioisosteres including many examples http://www.cambridgemedchemconsulting.com/resources/bioisoteres/ in which the chemical structures are shown with dropped shadows.
I use ChemBioDraw to draw the structures and then save as PNG files with a transparent background. The structures are then dropped onto webpages created using RapidWeaver, within RapidWeaver there is an option to add dropped shadows to images. I was recently asked whether there was any other way to create the same effect and Matt at macosxtips suggested using ImageMagick. This applescript droplet allows you to do so by simply dropping the file.
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.
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.
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:-
- AppleScript Cocoa - AppleScriptObjC
- Bash Shell
- C Shell
- C and C++
- F-Script Cocoa
- Korn Shell
- Lua Cocoa
- Python Cocoa - PyObjC
- Ruby Cocoa
- Tenex C Shell
- Z Shell
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.
I’ve also added it to the list of Applescript Resources.
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.
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
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
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.
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>
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.
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.
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.
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.