Travis this be cool. What I would like to do is parse ever field out of the string. The would be a hour, minute, second, am pm, year, month and so on. How does one find the structure of date? Thanks Louie [EMAIL PROTECTED]
----- Original Message ----- From: "Travis Siegel" <[EMAIL PROTECTED]> To: "Discussions on developing for Mac OS X by the blind" <[email protected]> Sent: Sunday, December 11, 2005 4:09 PM Subject: Re: Apple script > Yeah, I noticed that too. It has a lot to do with what datatype the > data is. Apparently strings are interpreted letter by letter, > whereas other data types such as date are interpreted as uunits for > each portion of the date. Here's something that does what you want, > though it doesn't use terminal to do so. You can of course still use > terminal in your script, as the results will be the same. > > ** begin script** > set thedate to (current date) as date > set time1 to time string of thedate > say "It is " > say time1 > **End script** > This doesn't use the item usage described before, but with the date > type, it does work as expected. I have no idea why strings are > treated as letters instead of words. You could of coourse use the > repeat command to get each word individually using space as the > matching char for separation. It seems to me there should be another > method for doing this. I'll see if I can find it. I'm only a > beginner with apple scripting, so I know there's things I have > overlooked or not learned. > On Dec 11, 2005, at 2:37 PM, louie wrote: > >> Travis Thanks for the help. It did not work like you said. >> set dat to current date as string >> set d to get item 1 of dat >> say d >> What this code produced was the first letter of the string or >> should I say >> list. >> >> Louie >> [EMAIL PROTECTED] >> >> ----- Original Message ----- >> From: "Travis Siegel" <[EMAIL PROTECTED]> >> To: "Discussions on developing for Mac OS X by the blind" >> <[email protected]> >> Sent: Saturday, December 10, 2005 11:11 PM >> Subject: Re: Apple script >> >> >> >>> To get any part of a string (Apple calls them lists) you use the >>> "Item" keyword. >>> I.E. item 4 of D in your example would include the year. >>> Get Item 4 of D would result in D containing 2005. >>> Hope this helps. >>> On Dec 8, 2005, at 8:25 PM, louie wrote: >>> >>> >>>> Hi all, >>>> I am trying to figure out how to parse a string. >>>> the string is created with the below line of code. >>>> set d to current date as string >>>> This produces the string >>>> Thursday, December 8, 2005 5:15:11 PM >>>> What I would like to do is get the month, name of day, day of month >>>> and year. >>>> Thanks for any help. >>>> Louie >>>> [EMAIL PROTECTED] >>>> _______________________________________________ >>>> Developer mailing list >>>> [email protected] >>>> http://macvisionaries.com/mailman/listinfo/ >>>> developer_macvisionaries.com >>>> >>>> >>> >>> >>> _______________________________________________ >>> Developer mailing list >>> [email protected] >>> http://macvisionaries.com/mailman/listinfo/ >>> developer_macvisionaries.com >>> >>> >> >> >> >> _______________________________________________ >> Developer mailing list >> [email protected] >> http://macvisionaries.com/mailman/listinfo/ >> developer_macvisionaries.com >> > > _______________________________________________ > Developer mailing list > [email protected] > http://macvisionaries.com/mailman/listinfo/developer_macvisionaries.com > _______________________________________________ Developer mailing list [email protected] http://macvisionaries.com/mailman/listinfo/developer_macvisionaries.com
