I have a slight problem, I’ve a AppleScript project built in XCode where I want the user to be able to select multiple PST files from a table view and get them imported into Entourage.
Does anybody have any sample scripts for allowing multiple selections from a table view?.
to GetKeys()
tell (table view 1 of scroll view 1 of window "key_window")
set allItems to (contents of data cell "key_words" of data rows of it's data source)
set s_keys to (call method "objectsAtIndexes:" of allItems ¬
with parameter (call method "selectedRowIndexes" of it)) --Creates list of selected keywords
end tell
return s_keys
end GetKeys
As long as you have named your data column in IB properly, this baby works like a champ. I, however, did not write the routine, I lifted from some thread here, but I can’t locate it again.
Thanks Craig for the code, only problem is I can’t show what the user selected. code below:
on clicked theObject
if name of theObject = “reveal” then
tell (table view 1 of scroll view 1 of window 1)
set allItems to (contents of data cell “key_words” of data rows of data source of table view 1 of scroll view 1 of window 1)
set s_keys to (call method “objectsAtIndexes:” of allItems with parameter (call method “selectedRowIndexes” of it)) --Creates list of selected keywords
end tell
end if
if (length of s_keys is less than 0) then
display dialog “empty selection”
display dialog s_keys
end if
end clicked
Once clicked, it will display to tell me that its not a empty selection, but the next display dialog just gives back “NSInternalScriptError (8)”… any ideas?