Just assign IBOutlets to your two tables and use those names in your if statement, for example if your outlets were table1 and table2, you could just write:
if aNotification’s object is table1 then
–do something with table1
else
–do something with table2
end if
on tableViewSelectionDidChange_(aNotification)
log "table view selection has changed..."
tell theArrayController to set theSel to selectedObjects() as list
set xmlPathAsUrlString to convertPath_to_Url_(theXMLPaths of item 1 of theSel)
set pdfPathAsString to convertPath_to_Url_(thePDFPaths of item 1 of theSel)
renderPdfOfSelectedRow_(xmlPathAsUrlString,pdfPathAsString)
if aNotification's object is the_invoices_table then
log "the_invoices_table"
else
log "the_folders_table"
end if
end tableViewSelectionDidChange_
I pasted your code into my app and commented out the middle group of lines (between the first log statement and the if block) since I have no way to test those – the remaining code worked fine. Try commenting those lines out and see what happens.
Did you make that method, tableViewSelectionDidChange_(aNotification), an IBAction for your table? It looks like from the error message that you are trying to get the value of “object” from the table view. I reread your first post, and it looks like that’s what you did. That’a not how delegate methods like “tableViewSelectionDidChange:” work. You don’t make this the action for your table view. You make your script the delegate of your two table views (from the connections pane in the inspector in IB), and then this method gets called by the table view when the selection changes.
I clicked in the little cube for my appDelegate then → Connections inspector → received actions , connected “tableViewSelectionDidChange:” to both tables.
That’s it.
Should I have done it differently?
The code works. I just can’t write further code to distinguish the tables.
If I just could convert “<NSTableView 0x103110170>” to some usable data…