I have a table view that lists out the files that are dragged onto it. The action runs fine before I drag any files onto it, after however it disables the run. What’s going on?
on add_item_to_list(theItemName, theDataSource)
set the theItem to get (POSIX file (theItemName as string)) as alias
set is_a_file to true
if is_a_file is true then
set theDataRow to make new data row at end of data rows of theDataSource
set contents of data cell "fileNameColumn" of theDataRow to extract_filename_from(theItem) as string
set contents of data cell "filePathColumn" of theDataRow to theItem
set contents of data cell "headerOption" of theDataRow to yes
set contents of data cell "annotateOption" of theDataRow to yes
end if
end add_item_to_list
on drop theObject drag info dragInfo
set theFiles to {}
set preferred type of pasteboard of dragInfo to "file names"
try
set theFiles to the contents of pasteboard of dragInfo
on error
display dialog "Could not set the list of files for some reason."
end try
if (count of theFiles) > 0 then
set theDataSource to data source of theObject
set update views of theDataSource to false
repeat with theItem in theFiles
add_item_to_list(theItem, theDataSource)
end repeat
set update views of theDataSource to true
end if
set preferred type of pasteboard of dragInfo to ""
return true
end drop