Newbie Question -- Table View & Changing Data Sources


I’m very new to Applescript studio and have a question that’s probably simple to answer, but I can’t seem to figure it out.

So, I have an application that I’m building that has no user data involved with it. The whole program is set up just to display a list of pre-defined numbers in a table. Per documentation provided I’ve learned how to add data via a button from text fields. I’ve also learned how to populate the table with data on “awake from nib” using “append”. But what has been plaguing me is how to change the data to a new data source via a button click???

So basically I want to have several property lists like:

property tableData : {{|name|:“Bart Simpson”, city:“Springfield”, zip:“19542”, age:12}, {|name|:“Ally McBeal”, city:“Boston”, zip:“91544”, age:28}, {|name|:“Joan of Ark”, city:“Paris”, zip:“53255”, age:36}, {|name|:“King Tut”, city:“Egypt”, zip:“00245”, age:45}, {|name|:“James Taylor”, city:“Atlanta”, zip:“21769”, age:42}}

which is displayed in a table view. Then I want to be able to change the list to a new property list lets say:

property tableData2 : {{|name|:“Judy Sorn”, city:“pork”, zip:“25789”, age:25}, {|name|:“Telly Sev”, city:“Austin”, zip:“21548”, age:45}, {|name|:“Bill Bradski”, city:“NYC”, zip:“23569”, age:88}, {|name|:“King Kong”, city:“Sudan”, zip:“74523”, age:95}, {|name|:“Jimmy Hendrix”, city:“San Fransico”, zip:“45698”, age:32}}

by clicking a button, then updating the table view to reflect the changes. ??? I’ve tried all kinds of methods to do this but nothing seems to work.

Any help would be great. Thanks in advance.


have you looked at the applescript examples? Developer/Examples/AppleScript Studio/

table sort
task list

you can also look here for info and in the search type “applescript table view”,“applecript data source”,“applescript persistant data”. it is going thur some updating foe xcode. But as of yet I haven’t found anything that wont work with my older tools.

BTW using the property value doesn’t save the data in a AS app so if your data has to be saved… property is not the solution you are looking for.

The property as originally set is saved in your AS Studio apps. Changes to the property during runtime are not. You can work around that by using the “user defaults” to save the changed property at quitting time and reload it at launch.


yep, i’ve looked at all of the resources mentioned above, that’s how I’ve been able to do what I’ve done so far. But I’m still missing some piece of the puzzle???

My application will not be saving anything, all it does is display predefined data. So all I want to do is have an easy way to display different data in a common table view with the click of a button. There has got to be an easy way to do this. So far the “append” function seems to be the easiest, but I can’t seem to get it to work from a button. I can get it to work by clicking on the table itself, but when I try to use a button to do the same thing I get a “NScontainer” error. So I know it’s something real easy that I’m missing. And I figure its how I’m targeting the table, but all the info I find says the same thing.

tell window of theObject
set table view “myTableView” of scroll view “myScrollView”

isn’t this enough to target the table???

Any help on this matter would be great.


Did you really look at the sources? The source for “Table Sort” has everything you need. Here is a quick app (it literally took 2 minutes to create) that swaps the data:


It was built in Xcode so I don’t know if you can open it in Project Builder. If not, here is the relevant code:


[This script was automatically tagged for color coded syntax by Script to Markup Code]

Works great, Thanks