Re: (resend)
Re: (resend)
- Subject: Re: (resend)
- From: Christopher Nebel <email@hidden>
- Date: Mon, 29 Mar 2010 15:11:13 -0700
On Mar 26, 2010, at 4:34 PM, Alex Zavatone wrote:
> On Mar 26, 2010, at 5:21 PM, Stockly, Ed wrote:
>
>>
>>
>>> Also, AppleScript seems to increase the word count in a string for every space character it runs into and also uses a colon as a word separator no matter what.
>>
>> One of two things is happening here. Either you’ve encountered a situation where text item delimiters have been set to “:” and not reset or you’re displaying a flavor of unicode text output as ascii and it’s getting munged. Either one is easy to fix if we see what generates this behavior.
>>
>> Go ahead and post the portion of the script that does this.
>
> I hate to tell you that I set the text item delimiter right before checking this in a simple test case and it didn't change anything.
Word separators are not the same thing as text item separators. Text item separators you can set yourself using "text item delimiters"; word separators are controlled by the system and the user's locale settings. In general, we recommend not using "word" elements to do parsing of form-like text like you're dealing with, since the results depend on settings the script has no control over, and the definition of a "word" is nowhere near as simple as just "a sequence one or more non-blank characters".
As for the specific results: any string of one or more spaces should count as a single word separator. If that's what you're seeing, fine; if you're seeing it count literally *every* space as a word separator (for example, "foo<space><space>bar" would have three words), then that sounds strange to me and I'd want to know what your locale is. Colon is typically *not* a word separator when it occurs between two letters; it is a word separator when it occurs between two numbers.
Incidentally, System Events or Finder can express what you're trying to do directly: "every folder of targetFolder". (Or perhaps "name of" that, if you just want the folder names.)
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden