On Dec 4, 2007, at 6:38 PM, Clint Hoxie wrote: Anyway, I am getting an error which looks to be telling me that a date can't be returned as a string.
When asking questions about errors, it helps if you paste the actual error message. set TomorrowDate to (month of (current date)) + 60 * 60 * 24 & "/" & (day of (current date)) + 60 * 60 * 24 & "/" & (year of (current date)) + 60 * 60 * 24
display dialog "Enter event date:" default answer TomorrowDate
The error is: “Can’t make {86412, "/", 86404, "/", 88407} into type string.”
You can't turn a list into a string unless all the items are strings. You need to convert the numbers to strings.
When you concatenate using “&” and the first item is a string, then AppleScript will attempt to convert the next object you concatenate to a string and concatenate the strings together:
but if the first item before “&” is not a string, you get a list of the objects being concatenated together:
12 & "/" => {12, "/"}
That is, the type of the left-hand side object determines how the two objects are concatenated together. In your case, you've concatenated to a number, which isn't what you want to do.
There are two solutions:
1. You can explicitly convert the numbers to strings with “as string”. In fact, you only have to do this for the first number, because once it's converted to a string, the subsequent concatenations of numbers will attempt to convert them to strings:
(12 as string) & "/" & 11 => "12/11"
or you can start building your string by concatenating to an empty string, e.g.:
"" & 12 & "/" & 11 => "12/11"
And then you'll notice that you're doing date math incorrectly (your math produces "86412/86404/88407") and you'll want to read the other replies on this thread to learn how to correct that.
-- Chris Page The other, other AppleScript Chris |