Applescript in iWork
28/11/08 06:57 Filed in: Applescript
Applescript has the potential to significantly
improve many work flows. Like all programming or
scripting languages it does have a learning curve,
but because of the simple structures and plain
language the curve is one of the easiest languages
to learn. The real power of the language is its
ability to interface between different programmes
allowing data to be transferred from one
application to another. It is also a quick way of
creating similar tools to Macros that are used in
Microsoft Office.
It comes as a surprise that one of Apples flagship applications, iWork, does not fully support Applescript. Neither Pages nor Numbers have applescript dictionaries associated with them, although Keynote does have a dictionary. This means that Pages and Numbers do not have publicly documented specific Applescript abilities. The good news is that this doesn't mean that Applescript can't be used with this applications.
Using the 'application' System Events you can easily control keystrokes, and occasionally buttons within most applications. To demonstrate how this is done, the following simple script is used to insert a standard reference into the active Pages document. Applescript Studio can then be used to create an interface which allows different references to be inserted all at the click of a button.
set the_text to "Hoek-Brown failure criterion - 2002 edition, 2002, E.Hoek; C. Carranza Torres; B. Corkum, Proc. NARMS-TAC Conference, Toronto, 2002, 1, 267-273, www.rocscience.com/hoek/references/H2002.pdf"
set the clipboard to the_text
tell application "System Events"
tell application "Pages" to activate
tell process "Pages" to keystroke "v" using command down
end tell
I find this script a real timesaver because I don't have to look up references every time I need to insert them into a document. All it takes is a simple click of a button.
It comes as a surprise that one of Apples flagship applications, iWork, does not fully support Applescript. Neither Pages nor Numbers have applescript dictionaries associated with them, although Keynote does have a dictionary. This means that Pages and Numbers do not have publicly documented specific Applescript abilities. The good news is that this doesn't mean that Applescript can't be used with this applications.
Using the 'application' System Events you can easily control keystrokes, and occasionally buttons within most applications. To demonstrate how this is done, the following simple script is used to insert a standard reference into the active Pages document. Applescript Studio can then be used to create an interface which allows different references to be inserted all at the click of a button.
set the_text to "Hoek-Brown failure criterion - 2002 edition, 2002, E.Hoek; C. Carranza Torres; B. Corkum, Proc. NARMS-TAC Conference, Toronto, 2002, 1, 267-273, www.rocscience.com/hoek/references/H2002.pdf"
set the clipboard to the_text
tell application "System Events"
tell application "Pages" to activate
tell process "Pages" to keystroke "v" using command down
end tell
I find this script a real timesaver because I don't have to look up references every time I need to insert them into a document. All it takes is a simple click of a button.
Omnigraffle template for geological sequences
28/11/08 06:38 Filed in: Omnigraffle
Omnigraffle is one of the best tools I've found for
creating engineering diagrams. Whilst it is
powerful, it is also quick and easy to use and you
can copy and paste PDF's straight from Omnigraffle
into either Keynote or Pages. This keeps the
quality and opacity of the diagrams that have been
created.
One of my favourite features of Omnigraffle is the ability to create your own templates. One of the most useful diagrams I work with is a standard borehole logging diagram. The patterns used in this diagram are from British Standard 5930 which means diagrams will be professional quality as well as quick to produce.
Download it here.
One of my favourite features of Omnigraffle is the ability to create your own templates. One of the most useful diagrams I work with is a standard borehole logging diagram. The patterns used in this diagram are from British Standard 5930 which means diagrams will be professional quality as well as quick to produce.
Download it here.