Playing with Apple Scripts

This tutorial will show you an hidden technology that connects Apple's Script Editor with iNMR. The author can't find any useful application for what is described here. His inability probably depends on the fact that the same author has never found a useful application for Apple Script in general. The experience and the ingenuity of the reader may instead suggest some very useful application or a new field of development for iNMR.


Open a simple 1-H FID with iNMR. Perform a minimal processing (it's enough that you press Cmd-Alt-R). Open the Script Editor (the standard Mac OS installation puts it into the “AppleScript” subfolder of the “Application” folder). Arrange the two windows so they are both visible without covering each other:

desktop

editor Copy the text below into the Script Editor.


tell application "iNMR"
  Lua "reload()"
end tell


Click the button “Run”.

Substitute the second line with:
Lua “wft()”
and run the modified script. Then try the following modifications, each time followed by a click into the button “Run”:


Lua "region(4,5) press'z'"
Lua "full()"
Lua "amp(10)"
Lua "amp(0.1)"
Lua "print(intreg())"
The last instruction reports the number of integral regions into the bottom section of the script editor. Now we create a new integral and verify that the number of regions has grown.

Lua "region(4,5) press'i'"
Lua "print(intreg())"

The concept should be clear enough, by now! Play ad libitum this final script:


tell application "iNMR"
  Lua "press 'B'"
end tell

 
Copyright © 2005-2010 nucleomatica
Valid XHTML and CSS. UTF-8 encoding.