Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #6142 > unrolled thread

Sending an email with a condition be verified

Started byGuillermo Sanchez <guillermo.sanchez@hotmail.com>
First post2011-11-03 08:51 +0000
Last post2011-11-04 11:14 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Sending an email with a condition be verified Guillermo Sanchez <guillermo.sanchez@hotmail.com> - 2011-11-03 08:51 +0000
    Re: Sending an email with a condition be verified A Retey <awnl@gmx-topmail.de> - 2011-11-04 11:04 +0000
    Re: Sending an email with a condition be verified Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-11-04 11:14 +0000

#6142 — Sending an email with a condition be verified

FromGuillermo Sanchez <guillermo.sanchez@hotmail.com>
Date2011-11-03 08:51 +0000
SubjectSending an email with a condition be verified
Message-ID<j8tkmd$f0h$1@smc.vnet.net>
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" -> "myname@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

[toc] | [next] | [standalone]


#6168

FromA Retey <awnl@gmx-topmail.de>
Date2011-11-04 11:04 +0000
Message-ID<j90gsh$skt$1@smc.vnet.net>
In reply to#6142
Am 03.11.2011 09:51, schrieb Guillermo Sanchez:
> 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" ->  "myname@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?

While it would be possible to tweak your example to basically do what 
you want, Dynamic is the wrong tool for that kind of tasks. One reason 
is that it only will update when shown on screen. Look for 
CreateScheduledTask, RunScheduledTask etc. for a better approach (these 
are available only in version 8, though).

hth,

albert

[toc] | [prev] | [next] | [standalone]


#6189

FromArmand Tamzarian <mike.honeychurch@gmail.com>
Date2011-11-04 11:14 +0000
Message-ID<j90hdq$sp2$1@smc.vnet.net>
In reply to#6142
On Nov 3, 7:51 pm, Guillermo Sanchez <guillermo.sanc...@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...@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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web