On Jan 2, 4:50=A0am, Sander Tekelenburg <u...@[EMAIL PROTECTED]
> wrote:
> In article
> <a80b8e5e-7e80-4bf2-8215-497ef86c0...@[EMAIL PROTECTED]
>,
>
> =A0b...@[EMAIL PROTECTED]
wrote:
> > I would like to write a conditional Applescript. The script would
> > trigger itself every few hours and if the computer is not connected to
> > the Internet I would like it to execute some code.
>
> You'll need to define what constitutes "connected to the Internet".
> There is no way to ceck for that condition. However, if you define what
> it means to *you*, tere will be certain conditions that *can* be checked
> for. You could for instance check if the machines has a
> non-self-assigned IPv4 address:
>
> property s_saIP : "269.254"
> set s_IP4 to IPv4 address of (system info)
> if s_IP4 does not start with s_saIP then
> =A0 =A0-- we are connected to a network
> =A0 =A0doStuff()
> end if
>
> on doStuff()
> =A0 =A0-- do stuff
> end doStuff
>
> This assumes [1] that the Mac uses IPv4, [2] that is set up to be
> assigned an address (by a DHCP server), [3] that the network the Mac
> conects to is actually connected to/part of "the Internet".
>
> For some reason (Tiger's) Standard Additions allows checking forthe
> primary IPv4 address only. If you use IPv6 or care about different
> network interfaces (Ethernet, Airport, FireWire, etc.), you'll prolly
> need to use do shell script.
>
> > I have a bit of
> > experience with AS but have no idea how to go about this one.
> > Perhaps: "if Safari gets message "computer not connected to the
> > internet" then execute this code"...
> > Am I on the right track?
>
> Yes, except that the Web, let alone Safari, is not "the Internet". It's
> perfectly possible to be connected to the Internet and yet not be able
> to fetch something off the Web.
>
> --
> Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>
>
> Mac user: "Macs only have 40 viruses, tops!"
> PC user: "SEE! Not even the virus writers support Macs!"
Thank you for your reply but this does not work. I always get
"10.37.129.3" as IPv4 address regardless if I am online or not. I am
using Leopard.
Thank you


|