where do you put a subroutine in a script?
i want to save files with a datetime_stamp sub route, but i cant figure out how to use it.
on get_datetime_stamp()
-- Date/Time routine based considerably on one written by Kevin Talbert. Thanks, Kev.
set todaysDate to (current date)
set timeString to time string of todaysDate
set AppleScript's text item delimiters to ":"
set a to every text item in timeString
set condTime to ((item 1 of a) & (item 2 of a) & (text 1 through -4 of (item 3 of a)))
set {m, d, y} to {month, day, year} of todaysDate
set monthList to {January, February, March, April, May, June, ¬
July, August, September, October, November, December}
repeat with i from 1 to 12
if m = (item i of monthList) then
set monthString to text -2 thru -1 of ("0" & i)
exit repeat
end if
end repeat
set dayString to text -2 thru -1 of ("0" & d)
set yearString to text -2 thru -1 of (y as string)
set datetime_stamp to monthString & "/" & dayString & "/" & yearString & "-" & condTime
return datetime_stamp
end get_datetime_stamp