Post

Replies

Boosts

Views

Activity

Applescript text item delimiters not working
I have a string of the form “Mon 22nd April”. I’m trying to extract the day (i.e. Mon), the date (i.e. 22nd) and the month (i.e. April) using this Applescript: set originalDateString to “Mon 22nd April” -- Extract the components by splitting the string set AppleScript's text item delimiters to " " set dayOfWeekAbbrev to text item 1 of originalDateString set dayOfMonth to text item 2 of originalDateString set monthName to text item 3 of originalDateString When I run this on its own it works as expected: dayOfWeekAbbrev is set to “Mon” dayOfMonth is set to “22nd” monthName is set to “April” When I run this inside a bigger script involving Numbers, the text item delimiters fails to work, no compile or run time errors occur and I end up with: dayOfWeekAbbrev is set to “M” dayOfMonth is set to “o” monthName is set to “n” I.e the first three characters of the string. If I replace originalDateString with the literal string “Mon 22nd April” I get the same result. In other words, text items and being recognized as individual characters, no delimiter (or delimiter is null). Totally confused.
5
0
350
Oct ’24