How To Get Error Line Number In Vbscript
Contents |
Join INTELLIGENT WORK FORUMSFOR COMPUTER PROFESSIONALS Log In Come Join Us! Are you aComputer / IT professional?Join Tek-Tips Forums! Talk vbscript err object line number With Other Members Be Notified Of ResponsesTo Your Posts Keyword Search
Vbscript Line Number
One-Click Access To YourFavorite Forums Automated SignaturesOn Your Posts Best Of All, It's Free! Join Us! *Tek-Tips's vbscript get current line number functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting Guidelines Promoting, selling, recruiting, coursework and thesis posting is forbidden.Tek-Tips Posting
Vbscript Get Line Number Text File
Policies Jobs Jobs from Indeed What: Where: jobs by Link To This Forum! Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.Just copy and paste the BBCode HTML Markdown MediaWiki reStructuredText code below into your site. VBScript Forum at Tek-Tips HomeForumsProgrammersLanguagesVBScript Forum get actual line number thread329-1329974 Forum Search FAQs Links MVPs get actual line number get actual line number RoMa68 (TechnicalUser) (OP) 2 Feb 07 09:04 How can i get the actual line number within the running vbscript?At the moment for debugging i use a debug-switch an message-boxes:If Debug <> 0 ThenMsgBox "227-Error reading XMLConfig"End IfBut on doing changes and adding lines i have to changes all following entries - how can i detect the actual line number?Thanks in advance... MR RE: get actual line number markdmac (MIS) 2 Feb 07 09:45 Depends on your editor.In notepad ensure line wrap is off and press Ctrl+G then type the line number and you will be brought to that line.Most other editors provide line numbers.For full debugging capabilities I suggest that you download Visual Web Developer Express (free from Microsoft).It supports vbscript and will let you debug while looking at the code the same way Visual Studio does.Do some searching on debugging in Visual Studio and you will learn how to "watc
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. http://www.tek-tips.com/viewthread.cfm?qid=1329974 Join them; it only takes a minute: Sign up How to get line error from subroutines that are read in or referenced via ReadAll via VBS? up vote 2 down vote favorite Hello a client of mine has a lot of VBSripts (VBS) that do various things. At the top of each script they reference a library of subs http://stackoverflow.com/questions/29850561/how-to-get-line-error-from-subroutines-that-are-read-in-or-referenced-via-readal and functions like this: Const ForReading = 1 Dim objFSO, objFile Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.OpenTextFile("Z:\path\VbsProcedures.vbs", ForReading) Execute objFile.ReadAll() 'more code that uses the subs and functions in VbsProcedures.vbs This way the subs and functions are available to the code below the lines. That is all good. I can work on the procedures all in one place. The issue is that when a procedure in VbsProcedures.vbs produces an error I don't get a line number to help me debug it. I just returns line 0 character 1, or something like that. How do I get an error line number in this case? I am wondering if there is a simple solution. I can put If Err.Number <> 0 Then after every suspect line and echo out an error description like this https://technet.microsoft.com/en-us/library/ee692852.aspx, but that seems quite inefficient. You can't use GoTo somelabel statements in VBS to handle errors for large blocks of code like you can in VBA. Edit: I can't post the VbsProcedures.vbs because it is my clients. I am looking
Error Handling. Err.Line weird behavior The SitePoint Forums have moved. You can now find them here. This forum is now closed to new posts, but you can browse existing content. You can find out more information about http://www.sitepoint.com/forums/showthread.php?279612-ASP-Error-Handling-Err-Line-weird-behavior the move and how to open a new account (if necessary) here. If you get stuck you can get support by emailing forums@sitepoint.com If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. SitePoint Sponsor User line number Tag List Results 1 to 5 of 5 Thread: ASP Error Handling. Err.Line weird behavior Thread Tools Show Printable Version Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Jul 11, 2005,08:34 #1 sixside View Profile View Forum Posts SitePoint Member Join Date Feb 2005 Posts 23 Mentioned 0 Post(s) Tagged 0 Thread(s) ASP Error Handling. Err.Line weird behavior I am adding some error handling into a script and how to get came across a very bizare behavior. Code: Dim strBody strBody = "" strBody = strBody & "Error at "&Time() &VBCRLF strBody = strBody & "Err.Line: " & Err.Line &VBCRLF strBody = strBody & "Err.Number: " & Err.Number &VBCRLF strBody = strBody & "Err.Description: " & Err.Description &VBCRLF strBody = strBody & "Err.Source: " & Err.Source &VBCRLF I then send the variable strBody in an email to myself. What is really weird is that the email comes back looking like this: Code: Error at 9:14:21 AM Err.Number: 438 Err.Description: Object doesn't support this property or method Err.Source: Microsoft VBScript runtime error Noice that the line Err.Line doesnt appear anywhere in the email!! Even if the syntax of Err.Line was wrong the text "Err.Line" should be in the email.. right!? Anyone know why this happens? And also how to get it to output the line number causing the error. Thanks Jul 12, 2005,11:18 #2 mikeistyke View Profile View Forum Posts SitePoint Addict Join Date Dec 2004 Location staunton Posts 207 Mentioned 0 Post(s) Tagged 0 Thread(s) Make sure you declared the variable correctly before calling it. What does the defined code of that variable look like? Jul 12, 2005,15:01 #3 rcristel View Profile View Forum Posts SitePoint Member Join Date Aug 2002 Location NY Posts 21 Mentioned 0 Post(s) Tagged 0 Thread(s) Hope this helps. I