Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Applescript > Re: Can Applesc...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 11 Topic 1557 of 1611
Post > Topic >>

Re: Can Applescript tell if computer is online?

by biz@[EMAIL PROTECTED] Jan 2, 2008 at 05:38 AM

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




 11 Posts in Topic:
Can Applescript tell if computer is online?
biz@[EMAIL PROTECTED]   2007-12-31 19:22:34 
Re: Can Applescript tell if computer is online?
Sander Tekelenburg <us  2008-01-01 18:50:28 
Re: Can Applescript tell if computer is online?
biz@[EMAIL PROTECTED]   2008-01-02 05:38:29 
Re: Can Applescript tell if computer is online?
iterate4@[EMAIL PROTECTED  2008-01-03 00:00:15 
Re: Can Applescript tell if computer is online?
Jolly Roger <jollyroge  2008-01-02 18:20:28 
Re: Can Applescript tell if computer is online?
biz@[EMAIL PROTECTED]   2008-01-02 17:14:25 
Re: Can Applescript tell if computer is online?
Sander Tekelenburg <us  2008-01-03 14:56:24 
Re: Can Applescript tell if computer is online?
biz@[EMAIL PROTECTED]   2008-01-03 16:13:55 
Re: Can Applescript tell if computer is online?
Sander Tekelenburg <us  2008-01-04 05:58:56 
Re: Can Applescript tell if computer is online?
Jolly Roger <jollyroge  2008-01-03 23:14:15 
Re: Can Applescript tell if computer is online?
biz@[EMAIL PROTECTED]   2008-01-03 17:05:07 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri May 16 22:18:24 CDT 2008.