on awake from nib theObject
set CharData to (read file "HFS:Path:To:File.csv")
set theDataSource to make new data source at end of data sources with properties {name:"CharDataSource"}
tell theDataSource
make new data column at end of data columns with properties {name:"SelectCol"}
make new data column at end of data columns with properties {name:"NameCol"}
make new data column at end of data columns with properties {name:"StatusCol"}
make new data column at end of data columns with properties {name:"MailCol"}
make new data column at end of data columns with properties {name:"BalanceCol"}
end tell
tell data source "CharDataSource"
repeat with a from 2 to (count (paragraphs of CharData))
set theRow to make new data row at end of data rows
tell theRow
set contents of data cell "NameCol" of theRow to word 1 of paragraph a of CharData
end tell
end repeat
end tell
end awake from nib
When I build and run, the interface comes up, but nothing happens. I’ve looked at numerous tutorials, and I’m still not sure what’s wrong here
Thanks SuperMacGuy, but I still get nothing in the table. Curiouser and curiouser. FYI, this is how is now reads:
on awake from nib theObject
set CharData to (read file "HFS:Path:To:File.csv")
set theDataSource to make new data source at end of data sources with properties {name:"CharDataSource"}
set data source of table view "TableView" of scroll view "ScrollView" of window "MainWindow" to "CharDataSource"
tell theDataSource
make new data column at end of data columns with properties {name:"SelectCol"}
make new data column at end of data columns with properties {name:"NameCol"}
make new data column at end of data columns with properties {name:"StatusCol"}
make new data column at end of data columns with properties {name:"MailCol"}
make new data column at end of data columns with properties {name:"BalanceCol"}
end tell
tell data source "CharDataSource"
repeat with a from 2 to (count (paragraphs of CharData))
set theRow to make new data row at end of data rows
tell theRow
set contents of data cell "NameCol" of theRow to word 1 of paragraph a of CharData
end tell
end repeat
end tell
end awake from nib
repeat with a from 2 to (count (paragraphs of CharData))
make new data row at end of data rows of theDataSource
set data source of table view "TableView" of scroll view "ScrollView" of window "MainWindow" to contents of theDataSource
set contents of data cell "NameCol" of data row a of data source of table view "TableView" of scroll view "ScrollView" of window "MainWindow" to word 1 of paragraph a of CharData
end repeat