• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tanaka's osax 2.01- MT Parse command ??
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tanaka's osax 2.01- MT Parse command ??


  • Subject: Re: Tanaka's osax 2.01- MT Parse command ??
  • From: email@hidden
  • Date: Wed, 24 Apr 2002 10:29:18 EDT

Bill,

It's a bit tricky - read Tanaka's dictionary carefully. The [MT Parse]
command produces a list of lists. Try this to understand better:

tell application "Finder"
set allParts to "partOne@partTwo@partThree#partA@partB@partC"
set prsr to "@"
set lndlm to "#"
set partsList to (MT Parse allParts item delimiter prsr line delimiter
lndlm)
display dialog (length of item 1 of partsList)
-->"3"
try
display dialog partsList as integer -- deliberate error
on error errmsg
display dialog errmsg -- see the created data structure
end try
end tell

Note that if you MT Parse "partOne@partTwo@partThree", the result will be
{{"partOne","partTwo","partThree"}}, but the above try block will make it
look like {"partOne","partTwo","partThree"} (at least OMM 9.1+1.5.5 - maybe
some silent coercion is happening). Use the event log as another way to view
the data structure of such beasts.

Jeff Baumann
email@hidden
www.linkedresources.com


In a message dated 4/23/02 5:56:37 PM, Bill Christens-Barry wrote:

>I'm trying to use Tanaka's osax 2.0.1 to parse a string into a list
>of parts, with an unexpected result:
>
>tell application "Finder"
> set allParts to "partOne@partTwo@partThree" as string
> set prsr to "@"
> set thePartsList to (MT Parse allParts item delimiter prsr)
> display dialog (length of thePartsList)
> -->"1"
> display dialog (thePartsList as text)
> -->"partOnepartTwopartThree"
>end tell
>
>I expected to get a list containing the 3 items
>{"partOne","partTwo","partThree"}, but was surprised by the effective
>removal of the parsing string. I've tried a variety of explicit
>coercions (to text, list, etc) without getting what I expected.
>
>I'm using MacOS 8.6 and the Applescript 1.3.7 extension. Any examples
>of how to do this successfully?
_______________________________________________
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.

  • Prev by Date: resize IE window
  • Next by Date: Re: Applescript file extensions
  • Previous by thread: Tanaka's osax 2.01- MT Parse command ??
  • Next by thread: Re: Re: Tanaka's osax 2.01- MT Parse command ??
  • Index(es):
    • Date
    • Thread