Basics of AppleScript

Import Records

Script [8.4.1]:

set studentData to {myName:"Nayan Seth", myAge:20}
set studentAge to myAge of studentData
set newStudentData to {age:studentAge}

Explanation: The above Script will import data from one record to another via an intermediate variable. So how does it work?

Well I have first created a record named studentData. I then went on to create a variable named studentAge which contains value of myAge used in studentData.

Finally I created a new record named newStudentData which contains a property named age. This property imports value from the variable studentAge.

Figure 8.4.1

Figure 8.4.1 Import Value from Record

Script [8.4.2]:

set studentData to {myName:"Nayan Seth", myAge:20}
set newStudentData to {age:myAge of studentData}

Explanation: In this case we don’t use an intermediate variable. We directly import value of myAge in studentData to newStudentData.

Figure 8.4.2

Figure 8.4.2 Import Value from Record Directly