• 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: Coerce a returned list of objects into a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coerce a returned list of objects into a string


  • Subject: Re: Coerce a returned list of objects into a string
  • From: Walter Ian Kaye <email@hidden>
  • Date: Sun, 4 Jul 2004 22:32:00 -0700

At 09:33p -0700 07/04/2004, Matt Petrowsky didst inscribe upon an electronic papyrus:

I am working on a tool to archive email from Mail.app and was wondering if anyone knows if you can coerce a list of objects into their string equivalents - at least as it is returned in Script Editor.

For example, you run this

tell application "Mail"
selection
end tell

You get this.

{message 22 of mailbox "Deleted Messages" of account "ISO" of application "Mail", message 57 of mailbox "Deleted Messages" of account "ISO" of application "Mail", message 86 of mailbox "Deleted Messages" of account "ISO" of application "Mail", message 99 of mailbox "Deleted Messages" of account "ISO" of application "Mail"}

Which is the english version of all the pointers to objects. But my goal is to get this english output as a string. Such as

message 22 of mailbox "Deleted Messages" of account "ISO" of application "Mail"
message 57 of mailbox "Deleted Messages" of account "ISO" of application "Mail"
message 86 of mailbox "Deleted Messages" of account "ISO" of application "Mail"
message 99 of mailbox "Deleted Messages" of account "ISO" of application "Mail"

Anyone know if this can be done?

Hi Matt. Try this:

tell application "Mail"
try
selection as application --sure to error ;)
on error errm
set errm to text 12 thru -16 of errm
end try
end tell

You will need to parse the result as well as perform substitutions of terminology for the classes 'mssg', 'mbxp', etc.

But that's how you do it. :-)


cheers,
-Walter
still vehemently opposed to text/html and multipart/alternative email
_______________________________________________
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.


  • Follow-Ups:
    • Re: Coerce a returned list of objects into a string
      • From: Matt Petrowsky <email@hidden>
    • Re: Coerce a returned list of objects into a string
      • From: Walter Ian Kaye <email@hidden>
References: 
 >Coerce a returned list of objects into a string (From: Matt Petrowsky <email@hidden>)

  • Prev by Date: Coerce a returned list of objects into a string
  • Next by Date: Re: Auto Reply to your message ...
  • Previous by thread: Coerce a returned list of objects into a string
  • Next by thread: Re: Coerce a returned list of objects into a string
  • Index(es):
    • Date
    • Thread