Re: Why won't this parse?
Re: Why won't this parse?
- Subject: Re: Why won't this parse?
- From: "Arthur J Knapp" <email@hidden>
- Date: Thu, 10 May 2001 18:09:14 -0400
>
Date: Thu, 10 May 2001 11:32:53 -0700
>
From: David Graham <email@hidden>
>
Subject: Re: Why won't this parse?
>
At 10:32 AM -0700 5/10/01, Paul Berkowitz wrote:
>
>That's
>
> ASCII character 32 = " "
>
>Since you wrote 'number' instead of 'character' you got
>
>
>
> ASCII number of 32 = ASCII number "3" = 51
>
This stuff is enlightening, however it still doesn't fix the problem. No
>
matter whether I set the TIDs to {" "} or {space} I still have the same
>
problem. Are you saying that I can't reliably use the space character as
>
a TID?
No, I think that you are saying that... ;-)
Let's go back to your original posting:
>
property theData : "alias PWI_AAA email@hidden
>
alias PWI_BBB email@hidden
>
alias PWI_CCC email@hidden
>
note PWI_AAA All San Diego Employees
>
note PWI_BBB All San Bernardino Employees
>
note PWI_CCC All South Bay Employees
>
"
Your final quote mark is just after a return, such that when
you go to ask for "paragraphs of", the last item in your list
will be an empty string, which is going to cause a problem,
so remove the last return:
property theData : "alias PWI_AAA email@hidden
alias PWI_BBB email@hidden
alias PWI_CCC email@hidden
note PWI_AAA All San Diego Employees
note PWI_BBB All San Bernardino Employees
note PWI_CCC All South Bay Employees"
>
set aliasList to {}
>
-- parse the nickname file
>
set nickFileEntries to paragraphs of theData as list
>
-- parse each entry and make a list of the aliases
>
repeat with thisEntry in nickFileEntries
>
set thisEntry to thisEntry as text
>
-- parse string into three parts (we only need the first two)
>
set AppleScript's text item delimiters to ASCII number 32 -- space
So the above line should become:
set AppleScript's text item delimiters to ASCII character 32
or
set AppleScript's text item delimiters to space
or
set AppleScript's text item delimiters to " "
>
-- grab the first two values of the string
>
set strType to text item 1 of thisEntry
>
set strNickName to text item 2 of thisEntry
>
set AppleScript's text item delimiters to {""}
>
-- make a list of aliases
>
if strType is "alias" then set aliasList to aliasList & strNickName
>
end repeat
>
>
return aliasList
-- > {"PWI_AAA", "PWI_BBB", "PWI_CCC"}
No problems for me. :)
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.LateNightSW.com