BookmarkSubscribeRSS Feed
chadw

Community Trekker

Joined:

Jul 9, 2014

How can I check to see if a website exists before receiving an error?

I am trying to create a script that will pull data from different websites.  I would like to test if a website exists and if not, then move on to another website.  With my current code, if the site does not exist I get a pop up error reading, "Cannot open table in access or evaluation of 'Open' , Open( Full_EI_WEB_Sites[1], invisible, HTML Table( 1 ) )".

Is there something similar to the File Exists() function, but for opening websites?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Byron_JMP

Staff

Joined:

Apr 26, 2012

Solution

Re: How can I check to see if a website exists before receiving an error?

Maybe try the Try(expr, catch expr) function. If the second argument is not included, then the script just runs when the expression throws an error.

bad=expr(dt1=open("not a file.txt"));

good=expr(today());

try(bad,show("bad ran"));

try(good,show("good ran"));

JMP Systems Engineer, Pharm and BioPharm Sciences
2 REPLIES
Byron_JMP

Staff

Joined:

Apr 26, 2012

Solution

Re: How can I check to see if a website exists before receiving an error?

Maybe try the Try(expr, catch expr) function. If the second argument is not included, then the script just runs when the expression throws an error.

bad=expr(dt1=open("not a file.txt"));

good=expr(today());

try(bad,show("bad ran"));

try(good,show("good ran"));

JMP Systems Engineer, Pharm and BioPharm Sciences
chadw

Community Trekker

Joined:

Jul 9, 2014

Re: How can I check to see if a website exists before receiving an error?

Sorry for the late reply.  The Try() function worked perfectly! 

Thanks for the help,

Chad