Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


RE: Error Message

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,45108
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Error Message
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: <<   < prev  1 [2]
Login
Message << Older Topic   Newer Topic >>
 RE: Error Message - 4/9/2007 7:56:20 AM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Thanks I will give it a go and let you guys know how I get on..

Many Thanks

James

(in reply to ebgreen)
 
 
Post #: 21
 
 RE: Error Message - 4/11/2007 10:02:07 PM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Hello,

I have tried what you have asked. Please could you guys have a quick glance over it and let me know whats going on or if its completly overkill?

I have done pretty much the same thing for the other vbs files which it runs from within the script...

If you guys give it the OK then I will start testing it...

Many Thanks

James


      

(in reply to ebgreen)
 
 
Post #: 22
 
 RE: Error Message - 4/12/2007 1:15:21 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
That is probably more error checking than I would put in but there isn't really any inherent reason not to. The only thing that I would say is that the normal way that I do this is to not use a global On Error Resume Next. Instead I put On Error Resume Next right before a line that I think might fail. Then after I check the value of Err.Number, I will put On Error Goto 0. This way if there is some error that you did not expect then you will actually see the error instead of having the error masked by a global On Error Resume Next.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 23
 
 RE: Error Message - 4/12/2007 3:15:55 AM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Hello,

I can understand where your coming from but I would need any errors to go sttraght into that text file and not pop up on screen and stop the script as if there is any data in the text file it will then send off the files to the servicedesk so we can lok into them.

Would your suggestion still do this?

Many Thanks

James

(in reply to ebgreen)
 
 
Post #: 24
 
 RE: Error Message - 4/12/2007 4:59:24 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
If you would prefer the script to never pop any error to the end user, then the Global On Error Resume next is the way to go.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 25
 
 RE: Error Message - 4/12/2007 6:21:50 AM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
So in theory it should be good to go now it will only ever log errors to that text file and then it will use a sub to mail off to the servicedesk.

Brilliant thanks for all your help and teachings!! :)

Its just my manager has set me this task and I have had to learn VBScript on the fly by doing things here and there and hence me posting like crazy in here but I would like to thank everyone who has helped me. Along my journey I have leared loads!!!

Now my manager has seen my efforts he has decided to send me on a VBScript course!!! Its a little late but hey ho its always welcome I might actually be able to get my head around it more! The only snag is its in November! A long way off but much learning to be done by then!

Again thanks for everything guys!!!

I will call again when there is something else my bible does not tell me or I cant get woking properly! :)

James

(in reply to ebgreen)
 
 
Post #: 26
 
 RE: Error Message - 4/12/2007 8:22:25 PM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Quick Question

Would the following code be ignored


      

If I am correct in thinking that the Global On Error Resume Next would ignore this if the registry entry was not there and just proceed as it does not refer he error handling to my text file and it would not pop up on screan to the user???

Am I correct?

Many Thanks

James

(in reply to morpheus83uk)
 
 
Post #: 27
 
 RE: Error Message - 4/12/2007 10:04:02 PM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Oh and when I use the If Statement I get an error saying:

Cannot use parentheses when calling a Sub

I dont get why it is saying this is it because the variables are diffrent in the sub than they are when there calling the sub?

Many Thanks

James

(in reply to morpheus83uk)
 
 
Post #: 28
 
 RE: Error Message - 4/13/2007 12:22:07 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Basicly On Error Resume Next makes the script try to run every line just like it normally does. It just means that if the line errors then it will just ignore the error and go on to the next line of execution. As for the error, your Error routine is a Sub so when you call it you need to remove the () so this line:

Error(Err.Number, Err.Description, Err.Source)

Should be:

Error Err.Number, Err.Description, Err.Source

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 29
 
 RE: Error Message - 4/13/2007 2:02:08 AM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Thanks for that so my error would get ignored as I have just found! :)

Thanks for the info on the error :)

James

(in reply to ebgreen)
 
 
Post #: 30
 
 RE: Error Message - 4/30/2007 2:42:07 AM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
Hello,

With my Sub Error:


      

And my if statement:


      

If the code error's at any point it still does not E-Mail like it is supposed to... It errored because it could not find a file... I had moved it to test the error reporting...

Any help appreciated.

James

(in reply to morpheus83uk)
 
 
Post #: 31
 
 RE: Error Message - 4/30/2007 3:02:32 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
I don't see anything in that code that would generate an email.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 32
 
 RE: Error Message - 4/30/2007 9:13:14 PM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
No there isnt anything in that code...

What is suspposed to happen is that it should log the error information into the test file and then part way through the code it will check the file size of the text file and then it will send an E-Mail based on that...

The code I have for this is:


      

I have taken out the proper server names in the above code just for security reasons I am sure your all ok with this...

Any Suggestions?

Many Thanks

James

(in reply to ebgreen)
 
 
Post #: 33
 
 RE: Error Message - 5/1/2007 12:55:00 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Hmmm...I don't typically send email that way. Does the email portion work if you pull it out and just try to run it by itself?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 34
 
 RE: Error Message - 5/1/2007 1:55:12 AM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
It does indeed... but the thing is as well its not actually writing into the text file either...

Any suggestions?

Many Thanks

James

(in reply to ebgreen)
 
 
Post #: 35
 
 RE: Error Message - 5/1/2007 1:59:52 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Ok, if it isn't writing to the file then is the error sub getting called at all?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 36
 
 RE: Error Message - 5/1/2007 7:06:28 PM   
  morpheus83uk

 

Posts: 305
Score: 0
Joined: 8/21/2006
Status: offline
I presume so...

Is there an easy way to test?

Many Thanks

James

(in reply to ebgreen)
 
 
Post #: 37
 
 RE: Error Message - 5/2/2007 1:04:34 AM   
  ebgreen


Posts: 4613
Score: 31
Joined: 7/12/2005
Status: offline
Put a WScript.Echo into the error sub to see if it is called at all.

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to morpheus83uk)
 
 
Post #: 38
 
 
Page:  <<   < prev  1 [2]
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> RE: Error Message Page: <<   < prev  1 [2]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts