Re: (resend)
Re: (resend)
- Subject: Re: (resend)
- From: Alex Zavatone <email@hidden>
- Date: Mon, 29 Mar 2010 21:50:07 -0500
Christopher, I'm setting this:
set Applescript's text item separators to " "
And yep, every space is another word.
It sucks.
What do you mean "the user's locale settings"?
I'm in Texas (yee, haw) using English.
I can send you the code if you'd like, thanks for getting in touch.
It is likely that is is pilot error, but possible combined with something esoteric about AppleScript's tell context.
Let me know if you want the code and I'll dig it up on Tuesday.
Cheers,
- Alex
On Mar 29, 2010, at 5:11 PM, Christopher Nebel wrote:
> 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
_______________________________________________
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