MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Sending an email with a condition be verified

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122656] Re: Sending an email with a condition be verified
  • From: Armand Tamzarian <mike.honeychurch at gmail.com>
  • Date: Fri, 4 Nov 2011 06:03:42 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j8tkmd$f0h$1@smc.vnet.net>

On Nov 3, 7:51 pm, Guillermo Sanchez <guillermo.sanc... at hotmail.com>
wrote:
> Dear All,
> I am looking for a sentence that check periodically a value and send
> an email when a condition be verified.
>
> For instance:  Test the "EUR/USD=94  (euro/dollar ratio) every 5 second
> and send an email if "EUR/USD=94>1.35 (only one email when the condition
> be verified)
>
> I think same thing such as (but stopping when an e mail be send)
>
> sm[mess_] := SendMail["To" -> "myn... at hotmail.com",
>  "Subject" -> "Test Message",  "Body" -> ToString[mess],  "Password" -
>
> > "secret"]
>
> ff := If[FinancialData["EUR/USD"] > 1.35, sm[FinancialData["EUR/
> USD"]]]
>
> Dynamic[Refresh[ff, UpdateInterval -> 5]]  (stopping when an email be
> send)
>
> Any idea?
>
> Guillermo

I wouldn't use Dynamic for that. Do should suffice:

Do[Pause[5]; If[FinancialData["EUR/USD"] > 1.35, sm[FinancialData["EUR/
USD"]]; Abort[]], {i, Infinity}]

so after the first instance of a true test you stop the run (I'm
assuming that is what you want to do?).

...but you need to check that Wolfram update their financial data on
that sort of timescale.

Mike



  • Prev by Date: Re: Mathematica 8.0.4 now available
  • Next by Date: Re: Footnotes, Endnotes in Mathematica
  • Previous by thread: Re: Sending an email with a condition be verified
  • Next by thread: Re: How to combine 2 list