NO LONGER MAINTAINED
Download Version 1.0.6 (176K) – 32 & 64-bit Intel Mac OS X 10.6 or later
Download Version 1.0.5 (176K) – PowerPC Mac OS X 10.3.9 or later, 32-Bit Intel Mac OS X 10.4 or later
The List & Record Tools Scripting Addition allows AppleScript to perform set logic on AppleScript lists and to manipulate the contents of AppleScript records. With List & Record Tools you can dynamically access record properties not known at compile-time.
Credits/Legal
THIS SOFTWARE IS PROVIDED AS-IS, WITHOUT WARRANTY OF ANY KIND. THE AUTHOR DISCLAIMS ANY DAMAGES THAT MAY RESULT FROM THE USE OR MISUSE OF THIS SOFTWARE.
THIS SOFTWARE IS COPYRIGHT © 2004-2010 LATE NIGHT SOFTWARE LTD. & MARK ALLDRITT. YOU MAY USE AND/OR DISTRIBUTE THE SOFTWARE WITHOUT RESTRICTION. IF YOU BUNDLE THE SOFTWARE WITH ANY COMMERCIAL OFFERING, YOU MUST DISPLAY THIS COPYRIGHT NOTICE IN THE SOFTWARE’S DOCUMENTATION AND/OR ABOUT BOX.
Installation Instructions
To install the List & Record Tools scripting addition on Mac OS X systems:
- Create a folder named ScriptingAdditions in your user account’s Library folder (known as
~/Library
) if one does not already exist. - Copy the List & Record Tools.osax into the
~/Library/ScriptingAdditions
folder.
Getting Started
To view the List & Record Tools dictionary (that lists all the commands and their options) just drop the List & Record Tools.osax file onto your favourite script editor.
The following are some brief examples illustrating how the List & Record Tools scripting addition can be used.
Record Processing
One of AppleScript’s major limitations is that it cannot dynamically access items in records – record keys must be known at compile time. The List & Record Tools scripting addition provides a series of commands for accessing records in a dynamic fashion.
AppleScript records can contain properties and user properties. A property is defined by an application through its dictionary and is represented internally via a 4-character code. A user property is defined within AppleScript. For example, name is a term defined by AppleScript and many applications. The code {name:”Mark”} creates a record containing a property with the 4-character code ‘pnam’ and the value “Mark”. The term myAge is not defined in any dictionary and creates a user property when used in a record: (e.g. {myAge:42}).
Accessing Properties
4 commands are provided for working with properties. You can get, set, or delete properties in a record, and you can get the 4-character IDs of all the properties in a record:
~~~~ get property “pnam” in {name:”Mark”} –> “Mark” set property “pnam” in {name:”Mark”} to “Gerry” –> {name:”Gerry”} get property IDs {name:”Mark”} –> {“pnam”} delete property “pnam” in {name:”Mark”} –> {} ~~~~
Accessing User Properties
4 commands are provided for working with user properties. You can get, set, or delete user properties in a record, and you can get the names of all the user properties in a record.
~~~~ get user property “myAge” in {myAge:42} –> 42 set user property “myAge” in {myAge:42} to 28 –> {myAge:28} get user property names {myAge:42} –> {“myAge”} delete user property “myAge” in {myAge:42} –> {} ~~~~
NOTE: On Mac OS X systems prior to 10.6, AppleScript converts user property names to lower case, unless the |Name| notation is used. Because of this, user property names myst be given in lowercase on pre-10.6 systems.
List Processing
The List & Record Tools scripting addition provides three commands for treating AppleScript lists as sets. These commands were originally part of the now discontinued LNS Scripting Additions. We have received frequent requests to provide them for Mac OS X.
Set Intersection (return all items that are common to two lists)
Here’s an example involving integers where the command returns only those integer values common to both lists:
~~~~ intersection of {1, 2, 3} and {2, 3, 4} — Result: — { — 2, — 3 — } ~~~~
This command can handle other data types such as strings, dates, etc. For strings, it honours AppleScript’s considering case, whitespace, hyphenation.
Set Difference (return items that are not common to two lists)
Here’s an example involving integers where the command returns only those values that are not common to both lists:
~~~~ difference of {1, 2, 3} and {2, 3, 4} — Result: — { — 1, — 4 — } ~~~~
This command can handle other data types such as strings, dates, etc. For strings, it honours AppleScript’s considering case, whitespace, hyphenation.
Set Union (return all unique items from both lists)
Here’s a simple example involving numbers where the command returns unique values from both lists:
~~~~ union of {1, 2, 3} and {2, 3, 4} — Result: — { — 1, — 2, — 3, — 4 — } ~~~~
Here’s another example involving numbers, booleans, and strings:
~~~~ union of {1, 2, true, “Hello”, 3, 4} and {false, 2, “Hello”, “Mark”, 10} — Result: — { — “Hello”, — “Mark”, — false, — 1, — 2, — 3, — 4, — 10, — true — } ~~~~
Like the intersection and difference commands, this command honours AppleScript’s considering case, whitespace, hyphenation.
Change History/Release Notes
1.0.6 June 28, 2010
- Support 64-Bit Intel systems.
1.0.5 June 7, 2006
- Properly support Mac OS X 10.3.9 systems.
1.0.4 April 21, 2006
- The Read Me First document once again directs you to this Web page.
1.0.3 March 31, 2006
- Native Intel Macintosh support (distributed as a Universal binary).
- The set property command returns a record when adding a property to {}.
1.0.2 August 28, 2005
- The filter list command now correctly locates types in lists. For example:
~~~~ filter list {1, string, 2} looking for type class — {string} ~~~~
- Corrected several errors and omissions in the Record & List Tools dictionary.
1.0.1 February 7, 2005
- Fixed a sorting problem that caused the union of, intersection of, and difference of, commands to return incorrect results in some situations.
Is it possible to get access to the source code so I can compile it on my M1 mac? I cannot get this Intel build to work. I assume the Intel build is incompatible?
I use AppleScript for all sorts of things and would love the dynamic helpers… especially b/c dynamic records minimize variable hierarchies when exploring them in Variables & Results in Script Debugger.
The issue is actually the lack of support for scripting additions on modern versions of macOS. You can get access to my scripting additions on macOS Mojave and later here:
https://forum.latenightsw.com/t/use-lns-freeware-scripting-additions-on-catalina-and-mojave/