Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Add quote of the day to Mail messages via web services Apps
If you want to add a random quote in Mail using a Web service, this simple script will do just that. You must be connected to the internet in order for this to work.

To customize it, in the "properties {content..." area of the script, you can add your own signature. In this example, I just put dashes because it is easy to illustrate how it works. Add your own text (and the return command for line breaks, as shown) to customize your signature.

The best place that I find to put the script is in the Scripts menu in the menu bar for easy access, and that way it is always available when I am ready to compose an email with my quote of the day.

You can get an idea of how this works by going to the RPC (Remote Server Call) profile website. The parameters of interest are Endpoint URL, SOAPAction, and Method Namespace URI. What is returned to you is the Output parameter in the form of a string.
  • Currently 2.60 / 5
  You rated: 2 / 5 (5 votes cast)

Add quote of the day to Mail messages via web services | 3 comments | Create New Account
Click here to return to the 'Add quote of the day to Mail messages via web services' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Add quote of the day to Mail messages via web services
Authored by: S Barman on Aug 18, '06 08:25:51PM
I could not get this to work. I then tried to cut it back to just display a dialog box and it continues not to work. Considering my knowlege of SOAP/XML programming is weak, I do not understand what is wrong.

Here's my version of the script:

	tell application ""
		set qotd to call soap {method name:"getQuote", method namespace uri:"urn:xmethods-qotd", SOAPAction:"urn:xmethods-qotd#getQuote"}
		display dialog qotd
	end tell
on error theErrorMessage
	display alert theErrorMessage
end try
Any suggestions?

[ Reply to This | # ]
Add quote of the day to Mail messages via web services
Authored by: on Aug 19, '06 01:16:07AM

The script is pretty simple so I am not seeing why it wouldn't work for you.

If you take out the
on error theErrorMessage
display alert theErrorMessage
and you run it, what are you getting in the Event Log? I ran your script without the error part and the event log is identical between your script and mine which means the quote is being returned.

Some other things to take into consideration. I am running Tiger version 10.4.7, are you running an earlier version? I am also running script editor v2.1.1 (81) AppleScript 1.10.7. Are you running an ealier version?

Do you have any Firewall that is preventing communication between your computer and SOAP server? Look in system preferences under Sharing and if there is a firewall turned on. For debugging turn off the firewall and try again.



[ Reply to This | # ]
You can get rid of one tell...
Authored by: tonyo on Aug 31, '06 10:43:53AM
You don't need to have a seperate tell statement for the viisible:true. Just tack it on to your properties statement:

tell application "Mail"
	set mynewmessage to make new outgoing message 
		with properties {content:return & "--------" & return & myquoteoftheday, visible:true}
end tell
Great idea, I've added it to my collection of mail scripts. Here's my own take on mail sigs using Fortune (assumes you have installed via Fink or Darwinports)

set textResult to do shell script "/opt/local/bin/fortune handey"
(* Change the fortune flag to your own fortune file or a favorite,
like humorists or zippy.
set theSig to "
Tony O                         tonyo at mac daht com
" & textResult
(* Put your own address in above.
tell application "Mail"
	set newMessage to make new outgoing message at end of outgoing messages with properties {content:theSig, visible:true}
end tell

[ Reply to This | # ]