Re: weird TID?
Re: weird TID?
- Subject: Re: weird TID?
- From: kai <email@hidden>
- Date: Thu, 23 Oct 2003 23:47:54 +0100
on Thu, 23 Oct 2003 15:16:38 -0600, Robert Poland wrote:
>
The below doesn't seem to behave. Am I doing something wrong? Smile
>
2.5.7 and OS 10.2.8.
----------------------------------
>
set startDate to text returned of (display dialog "Enter start date,
>
form 1/30" default answer "1/30")
>
tell me to set startDate to date startDate as text
>
--> "Thursday, January 30, 2003 12:00:00 AM"
>
>
set AppleScript's text item delimiters to ","
>
set tempMonth to (text item 2 of startDate) --> January 30
Actually Bob, it's:
--> " January 30"
(Note the leading space.)
>
set AppleScript's text item delimiters to {space}
Because of the leading space above, tempMonth's text items are now:
--> {"", "January", "30"}
...which is why you're getting:
>
set tempData1 to text item 2 of tempMonth --> should be 30 but I get January
>
set tempData to text item 1 of tempMonth --> January
----------------------------------
One way around this is to make sure your initial TIDs include a space:
--------
set AppleScript's text item delimiters to ", "
-- etc...
--------
However, while I don't know exactly where you're going with this, it looks
like you might be making hard work of it. Also, since a System's localised
date settings can affect the output of date strings, text manipulation of
them can be notoriously unreliable - and so the script may not travel well.
You might therefore like to consider something like this alternative:
----------------------------------
>
set startDate to text returned of (display dialog "Enter start date,
>
form 1/30" default answer "1/30")
set {m, d, y} to date startDate's {month, day, year}
-- do something with m, d and y
----------------------------------
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.