I’m new to AS Studio so I’m sure there must be something that I’m missing. I have tried all kinds of things to try to get a table to fill with file names dropped on the application icon. It seems like it doesn’t recognize theFiles information and it seems like the repeat function doesn’t work.
An application that I’m trying to somewhat mimic is FileRenamer 0.98
http://macscripter.net/news.php?id=4343_0_4_0_C, but I need my version to do different things.
Anyway, here’s the code that I’m having problems with.
property tableData : {{|fileNames|:"a"}, {|fileNames|:"b"}, {|fileNames|:"c"}, {|fileNames|:"d"}}
property tableList : {}
on open theFiles
repeat with i from 1 to number of items of theFiles
set this_item to item i of theFiles
tell application "Finder" to set theName to name of this_item
set end of tableList to {|fileNames|:(theName as string)}
end repeat
show window "fileWindow"
end open
on awake from nib theObject
-- Create the data source
set theDataSource to make new data source at end of data sources with properties {name:"fileList"}
-- Create each of the data columns, including the sort information for each column
make new data column at end of data columns of theDataSource with properties {name:"fileNames", sort order:ascending, sort type:alphabetical, sort case sensitivity:case sensitive}
-- Make this a sorted data source
set sorted of theDataSource to true
-- Set the "name" data column as the sort column
set sort column of theDataSource to data column "fileNames" of theDataSource
-- Set the data source of the table view to the new data source
set data source of theObject to theDataSource
-- Add the table data (using the new "append" command)
append theDataSource with tableList
end awake from nib
on idle theObject
(*Add your script here.*)
end idle
I am able to populate the table using tableData as opposed to using tableList so I do know the table is working.
Thanks in advance for any help.