• 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
parsing the results of last night's headache
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

parsing the results of last night's headache


  • Subject: parsing the results of last night's headache
  • From: Joshua Whalen <email@hidden>
  • Date: Sun, 2 Jan 2011 23:44:41 -0500

Thanks to christopher stone's kindly advice, I'm almost done with my little voicemail script -- only one obstacle remains!

Here's the script:

global theMessages
on run
	with timeout of 999999 seconds
		set old_delims to AppleScript's text item delimiters
		set text item delimiters to (ASCII character 10)
		tell application "Mail"
			subject of messages of inbox whose read status is false
			set theMessages to a reference to every text item of the result as list
		end tell
		repeat with i from 1 to the count of theMessages
			if item i contains "[Gizmo] Voicemail from:" then
				set myvoicemail to  item i
				display dialog myvoicemail
			end if
		end repeat

	end timeout
end run


the script seems to choke on extracting the data I want from the list.
What I ultimately want to do here is to go through my inbox, look for unread gizmo5 voicemails, and, 1 at a time, hand them off to  another script that extracts the phone numbers, searches my address book for the caller's name, and then speaks an announcement that I have a voice mail from so-and-so.

The rest of the program is done. I've tested it with a manually selected voicemail from my inbox and it works great. All I really need to do now is automate the part that loops through the inbox as described above.

the annoying thing is, I've written plenty of list parsers in the past that work great. Every now and then, though, for some reason, applescript throughs you a curve ball. I"ve re-written this routine a dozen ways in the past 12 hours, some result in "couldn't convert to string", others returned "error -1728" still others (the current version) return "apple event failed" and hang at "if item contains"

if anyone can explain why applescript has this bizarre habit of returning different results for the same parser chewing the same data in different contexts, I"d love to hear it. In the mean time, though, I'd just be thrilled to have this routine work.

TIA once again, and I love you all.

Joshua


Joshua Whalen
+1 (212) 457-9908
email@hidden
email@hidden
http://www.panix.com/~joshua/resume.html

"Vision without action is a day dream,
Action without vision is a nightmare."
-- Japanese proverb




 _______________________________________________
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

  • Follow-Ups:
    • Re: parsing the results of last night's headache
      • From: Michelle Steiner <email@hidden>
    • Re: parsing the results of last night's headache
      • From: Christopher Stone <email@hidden>
    • Re: parsing the results of last night's headache
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: grep 2.7 & linked-images
  • Next by Date: Re: parsing the results of last night's headache
  • Previous by thread: Re: Option key disables the return key???
  • Next by thread: Re: parsing the results of last night's headache
  • Index(es):
    • Date
    • Thread