Applescript file loop
I have a script that I've written below I would like to repeat the script for multiple files ie drop multiple files onto the Droplet and the action below is carried out on all the files.
I've had a stab at repeat/loop but to no avail I've copied others and cobbled the script together to use the name of a file to set the creation date on the file:-
The script works fine as a droplet on a single file however if I drop multiple files onto it I get an error.
This is my frist stab at an Applesrcipt so reckon Im missing out something pretty straightforward.
Any ideas how to amend the below?
on open theFiles
set theName to name of (info for theFiles)
set yy to characters 1 through 2 of theName as text as integer
if yy < 10 then set yy to "0" & yy
set mm to characters 3 through 4 of theName as text as integer
if mm < 10 then set mm to "0" & mm
set dd to characters 5 through 6 of theName as text as integer
if dd < 10 then set dd to "0" & dd
set hh to characters 8 through 9 of theName as text as integer
if hh < 10 then set hh to "0" & hh
set mn to characters 11 through 12 of theName as text as integer
if mn < 10 then set mn to "0" & mn
do shell script "touch -t " & yy & mm & dd & hh & mn & " " & quoted form of POSIX path of theFiles
end open
Macbook Pro, Mac OS X (10.4.10), 15" Screen