Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to execute a URL

Status
Not open for further replies.

amnewtovb

IS-IT--Management
Oct 14, 2004
3
0
0
US
I have the following script to access a URL from vb script.
This is used to flag a program to start some process.

It works perfect when everything is ok. If there is some problem with the network and when it cannot access the remote machine this script fails.

Is there anyway to send/make a notification to a user when this script fails.

url = "Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", url, false
call xml.Send()

Thanks in advance
 
Do you have 'On Error Resume Next' anywhere in your script?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
No I donot have that .
xml.Send() is the last statement in the script.

The failure can happen at this statement.


 
If there is some problem with the network and when it cannot access the remote machine this script fails.

What do you mean by "...this script fails."

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
it happened last week with a network failure, but no one knew it, because the network was restored after somtime
 
How about the following:

Code:
Function doSomething(a, b)

  On Error Goto doSomethingError

  ' do some work here

  doSomethingExit:
  Exit Function

  doSomethingError:
  MsgBox "Error occured"
  Resume doSomethingExit
End Function

I have not tested the above but should work for your problem.

Spong
 
I don't believe that VBScript supports labels and label gotos.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
i would try and avoid Goto's at all costs, regardless of if they are supported or not, :)
 
Is there anyway to send/make a notification to a user when this script fails.

I guess the first step is to find a way to identify when the script fails. You say it failed last week but no one knew? How do you know it failed? What constitutes a failure? What happens or does not happen that tells you there is or has been a failure?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top