DigDeep Posted March 10, 2017 Share Posted March 10, 2017 (edited) I am using @ScriptLineNumber to get the error message with the correct line number. If I use as per below, I am able to get the message but instead of the line 1303, it says 13956. I tried only as #Au3Stripper_Parameters=/rsln, but the script gives Variable not declared. I do not get any errors if I remove both the stripper lines. #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/mo /rsln GetFile() Local $GetFile = GetFile() If $GetFile = 0 Then MsgBox(48, "Error", "Line " & @ScriptLineNumber & @CRLF & "Error reading Page.") EndIf Edited March 10, 2017 by DigDeep Link to comment Share on other sites More sharing options...
Subz Posted March 10, 2017 Share Posted March 10, 2017 As per the helpfile @ScriptLineNumber - Line number being executed - useful for debug statements (e.g. location of function call). Only significant in uncompiled scripts - note that #include files return their internal line numbering Link to comment Share on other sites More sharing options...
Developers Jos Posted March 11, 2017 Developers Share Posted March 11, 2017 I am not sure what the actual reported issue is as the shown script will never give the error shown. au3stripper will (/mo) merge all #Include files into the master script and create one sourcefile called scriptname_stripped.au3 and (/rsln) replace all found @ScriptLineNumber macro's with the appropriated linenumber in this merged file. So what exactly is wrong and please post the appropriate script that actially has the error so I can check things. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Joboy2k Posted March 12, 2017 Share Posted March 12, 2017 (edited) Would it work with making a function at the end of the script that literally just tells you the @scriptlinenumber which will give you the number of the last line of the script (so now you know the total lines on the whole script including the #includes) then take away the compiled error away from the compiled total, then in theory it should give you the correct line thats giving you the error? (can't test this at the moment, just saw the problem and had a thought). this idea was stupid please ignore xD Edited March 12, 2017 by joboy2k mistake Link to comment Share on other sites More sharing options...
Developers Jos Posted March 12, 2017 Developers Share Posted March 12, 2017 (edited) Maybe it would help when it is first clear what the current issue is as it is hard to talk solutions when it isn't. @OP, Post some code and the steps you've done, that has the reported issue, so I can see/replicate it. Jos Edited March 12, 2017 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DigDeep Posted March 12, 2017 Author Share Posted March 12, 2017 @Jos My code has too many things to be posted but let me circle back and see if I can provide few parts which can show the error. My concern was that I have put lot of things inside my code. To understand where the issue is (let's just say if a file is downloading and Internet goes OFF and the file download stops...), I need to know the exact line that had caused the issue. The SetError / AutoIT error will not show the exact line and will throw up an error message with some random line which might not even exist. Using /mo with /rsln, gave me the correct message with the @ScriptLineNumber. The only issue was that it did not give the correct line number. To be short here, using the @ScriptLineNumber as just for the test purpose like the below gives you exactly the line number you wanted. MsgBox(0, 'Error', 'Error Line number is: ' & @ScriptLineNumber) But if you try to use the same inside a code which has thousands of lines and INCLUDES, it will not. Link to comment Share on other sites More sharing options...
mLipok Posted March 12, 2017 Share Posted March 12, 2017 2 minutes ago, DigDeep said: To be short here, using the @ScriptLineNumber as just for the test purpose like the below gives you exactly the line number you wanted. 2 minutes ago, DigDeep said: But if you try to use the same inside a code which has thousands of lines and INCLUDES, it will not. The second case as I suppose is when you use 3 minutes ago, DigDeep said: Using /mo with /rsln, And this mean you are using COMPILED version. And this give you exactly the same @ScriptLineNumber but from merged file ........_stripped.au3 When you RUN script (not compiled mode) AutoIt is gives to you @ScriptLineNumber "separate" in relation to each UDF. When you RUN compiled script then you have only one BIG merged file . Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
Developers Jos Posted March 12, 2017 Developers Share Posted March 12, 2017 37 minutes ago, DigDeep said: My code has too many things to be posted but let me circle back and see if I can provide few parts which can show the error. Don't expect me to try and figure out what could be wrong when you can't be bothered posting something that shows the issue. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DigDeep Posted March 12, 2017 Author Share Posted March 12, 2017 (edited) @Jos Here is a small example... Please compile with or without the Stripper /mo /rsln and then run the compiled version WITHOUT internet connection. #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=VLC Test.exe #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #AutoIt3Wrapper_Run_Tidy=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <FileConstants.au3> #include <File.au3> #include <IE.au3> Global $VLCSrc, $VLCDest Func VLC() $VLCSrc = 'http://get.videolan.org/vlc/2.2.4/win32/vlc-2.2.4-win32.exe' $VLCDest = 'c:\temp\vlc' DirCreate($VLCDest) InetGet($VLCSrc, $VLCDest & '\vlc.exe', 1, 1) EndFunc ;==>VLC VLC() Sleep(2000) If FileExists($VLCDest & '\vlc.exe') Then MsgBox(0, '', 'Success.') Else MsgBox(0, 'Error', 'Error Line number is: ' & @ScriptLineNumber) EndIf @mLipok Yes, if I am running the AU3 file, I am able to get the correct Line number reported. The issue comes up when the code is compiled. Edited March 12, 2017 by DigDeep Link to comment Share on other sites More sharing options...
mLipok Posted March 12, 2017 Share Posted March 12, 2017 (edited) As I said In your example you are using includes which are merged to one big file and this file is used in compiled version. So if you want to do it manualy open each include file which you are using, count them lines and find where is line number 5715. Or simply open your ****_stripped.au3 file and jump to this line. Then you will see what is going wrong, and you be able to compare it to your source script and find this specyfic line in your source script. Regards, mLipok Edited March 12, 2017 by mLipok Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
DigDeep Posted March 13, 2017 Author Share Posted March 13, 2017 (edited) @mLipok So, I checked the stripped.au3 file and below is the snapshot of it. That holds all my includes written there and then starting with the code lines, giving the Line number as 5715. Sorry, if I am going wrong here but is there any other way that can show the correct line number if @scriptlinenumber will not. Edited March 13, 2017 by DigDeep Link to comment Share on other sites More sharing options...
DigDeep Posted March 13, 2017 Author Share Posted March 13, 2017 So, I was also going through the Au3Stripper Help file and it goes as the @ScriptLineNumber will read the lines from the merged cells and not from the original script file. So 1 way for me to find whenever there is any errors: 1. Compile the original script with Au3Stripper Parameters 2. When error comes up, refer to the Au3Stripper code for the line number instead of the original Au3. I would say, this would work for time being but will be again time consuming to go through multiple locations, unless there was a way to figure out simply inside the original Au3 file itself. Please let me know if there would be any other method I can use here in place of @ScriptLineNumber and / or Stripper (any functions) that can show me the correct line number from the Compiled version of Original Au3 file. Appreciate all help Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2017 Developers Share Posted March 13, 2017 50 minutes ago, DigDeep said: Please let me know if there would be any other method I can use here in place of @ScriptLineNumber and / or Stripper (any functions) that can show me the correct line number from the Compiled version of Original Au3 file. This is not supported and honestly also don't know why I would be needed as you can find the line involved in the *_stripped.au3 script so it is easy for you to find that line in you original script yourself. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
DigDeep Posted March 13, 2017 Author Share Posted March 13, 2017 Well I think the error codes should be designed to be more user friendly to provide the exact message with line numbers what it is there in the actual au3 rather than to go through the stripper.au3 file and Correcting inside the Au3. This is like going here and there for a simple thing. No offense but just a thought. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 13, 2017 Developers Share Posted March 13, 2017 5 hours ago, DigDeep said: No offense but just a thought. No worries, I have no issue with people's opinions and in this case I can simply tell you how it works which is the way I and mLipok have described it. The stuff I have build with in this case au3stripper has been my personal initiative to make life easier as the compiled script doesn't contain any of the original linenumbers. Find supporters to convince me that I should spent a couple of hours to see whether i could make an addition to au3stripper to support your request. ( My guess is you probably don't want to pay for my hourly rate all by yourself ) Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 19, 2017 Developers Share Posted March 19, 2017 I had a look at your request and came up with (I hope) a simple approach for this. The replace of @ ScriptLineNumber remains the same for the #include files, but for the master script it will replace it by: "XXX/YYY" where XXX is the master script linenumber, YYY is the Merged script linenumber. au3stripper v 17.224.935.2 is available in the Beta directory for testing. What do you think? Jos benners and mLipok 2 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mLipok Posted March 19, 2017 Share Posted March 19, 2017 I'm very glad for this . I'll test tomorrow. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
benners Posted March 19, 2017 Share Posted March 19, 2017 4 hours ago, Jos said: I had a look at your request and came up with (I hope) a simple approach for this. The replace of @ ScriptLineNumber remains the same for the #include files, but for the master script it will replace it by: "XXX/YYY" where XXX is the master script linenumber, YYY is the Merged script linenumber. au3stripper v 17.224.935.2 is available in the Beta directory for testing. What do you think? Jos This works great for me when tested. The lines match up with both scripts. I normally use $i_LineNumber and set the line number so I get the line the erroring function is on but now I can look to change this. I tested on a big script with loads of includes and, a single line script such as the one below. The array include was removed and the line number reported correctly #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/rsln #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> MsgBox(0,'', @ScriptLineNumber) stripped MsgBox(0,'', "7/1") If I want to get the original script line for logging I can now use StringRegExpReplace(@ScriptLineNumber, '\/.*$', '') or @ScriptLineNumber - 0 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now