"Date modified" script strange behavior in Mavericks

Does anyone know why this Date Modified script is not working anymore in Mavericks?

I know there are some security issues in Mavericks and I have added applescript, finder, terminal and the script itself (Saved as application) in the Accessbility tab in security and privacy.

When dragging a file onto the script application the date modified changes in 14-12-2036 (!)

Whats going wrong here???

Code:

on open files_
display dialog "enter the new creation date in format YYYYMMDDhhmm ex: 200112251730:" default answer "" buttons {"Cancel", "Continue"}
copy the result as list to {the new_creation_date, the button_pressed}
repeat with file_ in files_
tell application "Finder"
set file_ to POSIX path of file_
do shell script "touch -t " & new_creation_date & " " & quoted form of file_
end tell
end repeat
end open

When dragging a file onto the script application the date modified changes in 14-12-2036 (!)

Whats going wrong here???

Click to expand...

Since the date is provided by the user, one thing to check is what date was typed in by the user.

As a general coding observation, it seems very strange to collect a flag indicating which button was clicked by the user but never checking the value of the flag. (For example, have you tested the "Cancel" behavior? It looks like the file dates will change no matter which button is clicked.)

Move the script statement outside the finder block.. Can you give an example?

Thanks!

Click to expand...

You can remove the tell "Finder" block completely.

Code:

on open files_
set {new_creation_date, button_pressed} to {text returned, button returned} of (display dialog "enter the new creation date in format YYYYMMDDhhmm ex: 200112251730:" default answer "" buttons {"Cancel", "Continue"})
if button_pressed is "Continue" then
repeat with file_ in files_
set file_ to POSIX path of file_
do shell script "touch -t " & new_creation_date & " " & quoted form of file_
end repeat
end if
end open

MacRumors attracts a broad audience
of both consumers and professionals interested in
the latest technologies and products. We also boast an active community focused on
purchasing decisions and technical aspects of the iPhone, iPod, iPad, and Mac platforms.