on process (f) «this sub-script is called once for each file dropped into the folder |
| «this version of the script just displays the name of the file in a dialog |
| dialog.alert (file.fileFromPath (f)) |
local (folder = file.getspecialfolderpath ("", "Desktop Folder", true) + "Watched by Agent:") |
if not file.exists (folder) |
local (adrtable = @scratchpad.folderwatcher) |
if not defined (adrtable^) |
| toys.newObject (tabletype, adrtable) |
| adrtable^.lastmoddate = date (0) |
| adrtable^.filesprocessed = 0 |
| if file.modified (folder) > lastmoddate |
| file.deleteFolder (origpath) |
| lastmoddate = file.modified (folder) «deleting files changed the mod date |
clock.sleepFor (5) «looks once every 5 seconds |