The following statements work with Panther:
set created to creation date of file_name
set created to created + 10 * minutes
It fails with Tiger with the error message “Can’t make missing value into type number.” The highlighed string is ‘10 * minutes’. Could someone give me the new syntax for Tiger? Also, is there a differences document somewhere? TIA
That script looks like it uses Finder.
tell application "Finder"
set created to creation date of file_name
set created to created + 10 * minutes
end tell
This should also work:
set created to (creation date of (info for fileName)) + (10 * minutes)
Actually, this sounds like a problem with the creation date.
Thanks for the reply and you are correct. It did turn out to be a problem with the creation date. I never saw this under Panther but under Tiger the creation date can return a value of “missing value” for whatever reason. I modified my code to check for that and if it is missing to use the modification date. I don’t know what I’ll do if someday both are “missing values.” It almost sounds like I need to use a ‘do shell script’ and the ‘ls -l’ command for better reliability.
‘Missing values’ have apparently been a problem in Finder file information returns since the introduction of OS X. Prior to that, the Finder would find out the information for itself. Now it has to ask System Events. For some reason, the AppleScript engineers still haven’t worked out how to make it wait for the information before reporting back. Often, all that’s needed is to ask a second time and the Finder will return the required result, having got the information from System Events in the mean time. Alternatively ” or as well ” you could tell the Finder to ‘update’ the item first.
Hopefully too, your file_name variable contains some sort of reference to the file, not just its name. 
tell application "Finder"
set created to creation date of file file_name
repeat while created is missing value
update file file_name
set created to creation date of file file_name
end repeat
end tell
set created to created + 10 * minutes
Bruce’s ‘info for’ suggestion (which requires an alias or file specification) is actually faster and more reliable for creation dates, but if you’re constrained to use the Finder, the above should help.
I’ve been trying to create a script that will apply modification dates to all files with a missing creation date, but I’m not having much luck. I’m just learning scripts, so if you could offer any help, I’d be very grateful! Here’s what I’ve been trying, but Finder keeps getting an error: Can’t set creation date to modification date.
tell application "Finder"
set these_items to the selection
end tell
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items) as alias
set this_info to info for this_item
tell application "Finder"
if creation date of file this_item is missing value then
set creation date of file this_item to modification date
end if
end tell
end repeat
Can’t figure out what I’m doing wrong, any suggestions?
Hi, Andrew.
The creation date of a file is set when the file’s created. As far as the Finder’s concerned, ‘creation date’ is a read-only property. The Finder can’t change its value.
As you may have gathered from the discussion above, the Finder’s no longer very good at getting information about files immediately, as it has to get it from System Events. If a creation date is reported as ‘missing value’, it just means the Finder doesn’t know the proper value, not that that’s what the value is or that the value’s missing from the file.