add files to filelist with drag'n drop

hello,

I have a Script where I can drop files into a box and the result is a filelist in an textviewitem. when I drag again some objects the list is cleared and I have a new list with the new files. this is because I set thedatatext to “”. How do I have to change the code, that when I drag another file, the file will be added to the list?

thx - M.


on conclude drop theObject drag info dragInfo
	
	set preferred type of pasteboard of dragInfo to "file names"
	set fileList to contents of pasteboard of dragInfo
	set theDataText to ""
	repeat with currentItem in fileList
		tell application "Finder"
			set theDataText to theDataText & (currentItem as reference) & return
		end tell
	end repeat
	tell window "main" to set contents of text view "file data" of scroll view "file data scroll" to theDataText
	set preferred type of pasteboard of dragInfo to ""
	doUpdate()
	
end conclude drop

You’re right, the problem lies in the line…

You could use a property to retain the value across multiple executions of the handler. Just delete the above line, and add the following line to the top of your script…

property theDataText : ""

Or, you could read the current value every time and then append to it’s value. Replace the line with this…

set theDataText to contents of text view "file data" of scroll view "file data scroll" of window "main"

Both will essentially perform the same function. Hope that does what you want…
j

yeah, that’s it. thanks.

another question:

I try to use the data with compressor. because theres no scripting for compressor I made a droplet and try to open it with the following code.


		repeat with currentItem in fileList
			tell application "Finder"
				open (currentItem as POSIX file as alias) using application file "droplet"
			end tell
		end repeat

this works fine, but only for the first file. Do you know a way to “drop” more files at once on the droplet?

thx again
michael