Reputation: 338
Posting the code is losing the formatting that is causing the issue, copying what I in the post will actually do what it should. To bad that isn't an option in using the script, so I uploaded the script file here with an example of the text built in that is causing the issue. I will try to convey what the issue is still.
I am pulling text from mail.app. The emails I am parsing have within them a list of dates (amongst other things):
5/27/2012
5/28/2012
5/29/2012
5/30/2012
5/31/2012
6/1/2012
6/3/2012
6/4/2012
6/5/2012
6/6/2012
Now I'm trying to get the dates into a list. No problem I thought...
The following did NOT work:
Using paragraphs did NOT work, returned the entire thing as a paragraph
set AppleScript's text item delimiters to (ASCII character 13) -- (Carriage Return)
set AppleScript's text item delimiters to (ASCII character 10) -- (LF)
Neither of the delimiters worked. I wondered what exactly the ASCII code of the 'return' was so I made the following:
set rundates to "5/27/2012 5/28/2012 5/29/2012 5/30/2012 5/31/2012 6/1/2012 6/3/2012 6/4/2012 6/5/2012 6/6/2012 6/7/2012 6/8/2012 6/10/2012 6/11/2012"
set mylist to {}
repeat with z from 1 to count of characters of rundates
copy (ASCII number (character z of rundates)) to end of mylist
end repeat
--return mylist ---{53, 47, 50, 55, 47, 50, 48, 49, 50, 13, 53, 47, 50, 56, 47, 50, 48, 49, 50, 13, 53, 47, 50, 57, 47, 50, 48, 49, 50, 13, 53, 47, 51, 48, 47, 50, 48, 49, 50, 13, 53, 47, 51, 49, 47, 50, 48, 49, 50, 13, 54, 47, 49, 47, 50, 48, 49, 50, 13, 54, 47, 51, 47, 50, 48, 49, 50, 13, 54, 47, 52, 47, 50, 48, 49, 50, 13, 54, 47, 53, 47, 50, 48, 49, 50, 13, 54, 47, 54, 47, 50, 48, 49, 50, 13, 54, 47, 55, 47, 50, 48, 49, 50, 13, 54, 47, 56, 47, 50, 48, 49, 50, 13, 54, 47, 49, 48, 47, 50, 48, 49, 50, 13, 54, 47, 49, 49, 47, 50, 48, 49, 50}
---===== Notice the 13s? So this should work right? ====---
So my delimiter using 13 should have worked, but it doesn't.
Anyone have any ideas?
Upvotes: 0
Views: 949
Reputation: 19030
I get different results from your post of the ascii numbers. Actually now that applescript is unicode we use "id" now instead of ascii number. It seems your character is "8232". So use this in your code before you get the text items...
set AppleScript's text item delimiters to character id 8232
Upvotes: 1