ViciousXUSMC Posted March 18, 2020 Share Posted March 18, 2020 So this is a dumb question, and the wrong way to solve a problem. I have a random error in a script that is already out in the wild compiled as an .exe and I get the "crash" that tells me what line it failed at in the code. Of course this does not match the line numbers in my source .au3 file. It also does not seem to prevent the script from doing it's job so its probably crashing on the last iteration of a loop. Because the error is quite rare and already in the wild and I know what line # is causing it, is there a way with Scite to basically produce the same raw code that would be present in the compiled .exe? This way I can match up the line causing the issue and fix it? Regards, Link to comment Share on other sites More sharing options...
TheXman Posted March 18, 2020 Share Posted March 18, 2020 Au3stripper with /mo parameter. /mo : Just merges the Include files into the source and strips the Comments. This is similar to aut2exe and helps finding the errorline. ViciousXUSMC and Earthshine 2 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 18, 2020 Author Share Posted March 18, 2020 1 hour ago, TheXman said: Au3stripper with /mo parameter. /mo : Just merges the Include files into the source and strips the Comments. This is similar to aut2exe and helps finding the errorline. Thanks that was what I was looking for earlier, just couldn't find the parameter I needed. It actually did not help with my problem as the 1000 lines is far short of the line 3000 that reported an error, but at least now I know a new skill. I'll have to wait until I find another computer with the issue and see if I can recreate it then I will figure it out. Thanks for the help. TheXman 1 Link to comment Share on other sites More sharing options...
TheXman Posted March 18, 2020 Share Posted March 18, 2020 You're welcome. On a totally different subject, thank you, I've enjoyed a lot of your Youtube content related to network hardware. Even though I'm retired, I still enjoy playing with that stuff too. ViciousXUSMC 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman Link to comment Share on other sites More sharing options...
Zedna Posted March 19, 2020 Share Posted March 19, 2020 For better tracking of misterious errors add logging to file based on some global (INI?) parameter. On problematic machine just switch ON logging and then analyze LOG file to see what's going on inside your application. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
seadoggie01 Posted March 19, 2020 Share Posted March 19, 2020 I've been deploying software to another department inside my company that doesn't have any shared access with us. To see when they're having an issue, I debug to a log and send an email to myself on any error that I can't recover. I send email without user interaction and attach the debug log and the error message. Similarly, you could a have a wrapper program that launches your main program that will send an email if the exit code isn't 0... which is the default if there is an error, I think All my code provided is Public Domain... but it may not work. Use it, change it, break it, whatever you want. Spoiler My Humble Contributions:Personal Function Documentation - A personal HelpFile for your functionsAcro.au3 UDF - Automating Acrobat ProToDo Finder - Find #ToDo: lines in your scriptsUI-SimpleWrappers UDF - Use UI Automation more Simply-erKeePass UDF - Automate KeePass, a password managerInputBoxes - Simple Input boxes for various variable types Link to comment Share on other sites More sharing options...
Musashi Posted March 19, 2020 Share Posted March 19, 2020 Additional Info : https://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/Au3Stripper.html #Au3Stripper_Parameters=/MO /MergeOnly /MO Will produce a scriptfile as AUT2EXE includes in the Compiled EXE. This allows you to find the proper linenumber when errors are reported.Note: Make sure you remove the #pragma lines or else the linenumbers will be off by the that number of records @ViciousXUSMC : Run the master script through au3stripper with the /MO parameter and check the produced [scriptname]_stripped.au3 for the linenumber in the error - but be aware of #Pragma statements, if you use any. "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." Link to comment Share on other sites More sharing options...
mikell Posted March 19, 2020 Share Posted March 19, 2020 For the fun ...I formerly made for myself a litle tool to do this. It's rough (of course) but maybe it could help Sorry for the french language. It should be understandable thoughPlease be indulgent expandcollapse popup#include <GUIConstantsEx.au3> #include <ListViewConstants.au3> Global Const $__LISTVIEWCONSTANT_WM_SETREDRAW = 0x000B Opt("GUIDataSeparatorChar", ChrW(9617)) $gui = GUICreate("test", 520, 360, -1, 150) $listview = GUICtrlCreateListView("Lignes", 10, 50, 500, 300) GUICtrlSetFont($listview, 8.5, 0, 0, "Tahoma") GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, 480) GuiCtrlCreateLabel("Ligne à chercher :", 20, 17, 100, 20) $Input = GUICtrlCreateInput("", 110, 15, 40, 20) $Vazi = GUICtrlCreateButton("Charger le script", 180, 15, 120, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Vazi $n = GuiCtrlRead($Input) ; If $n = "" Then ContinueLoop $au3 = FileOpenDialog("Sélectionner le script à analyser", @scriptdir, "Scripts (*.au3)", 0, "", $gui) If @error Then ContinueLoop $Au3Stripper = _SetAu3Stripper(@tempdir) If @error Then Exit Msgbox(48, "error", "Impossible de charger Au3Stripper") GUICtrlCreateListViewItem("Traitement du script ...", $listview) RunWait('"' & $Au3Stripper & '" "' & $au3 & '" /mergeonly', "", @SW_HIDE) $stripped = StringTrimRight($au3, 4) & "_stripped" & ".au3" $stripped_txt = StringRegExpReplace(FileRead($stripped), '(?m)^\s*#(pragma|include).*\R', "") $lines = StringSplit($stripped_txt, @crlf, 1) GuiCtrlSendMsg($listview, $LVM_DELETEALLITEMS, 0, 0) If $n > $lines[0] Then GUICtrlCreateListViewItem("Le fichier complet n'a que " & $lines[0] & " lignes", $listview) ContinueLoop EndIf GuiCtrlSendMsg($listview, $__LISTVIEWCONSTANT_WM_SETREDRAW, False, 0) For $i = 1 to $lines[0] GUICtrlCreateListViewItem($i & " : " & $lines[$i], $listview) If $i = $n Then GuiCtrlSetColor(-1, 0xdd0000) Next GuiCtrlSendMsg($listview, $__LISTVIEWCONSTANT_WM_SETREDRAW, True, 0) Local $tPoint = DllStructCreate("long X;long Y") GUICtrlSendMsg($listview, $LVM_GETITEMPOSITION, $n-6, DllStructGetPtr($tPoint)) GUICtrlSendMsg($listview, $LVM_SCROLL, DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y")) EndSwitch WEnd Func _SetAu3Stripper($path) Local $exe = $path & "\Au3Stripper.exe" If not FileExists($exe) Then GUICtrlCreateListViewItem("Chargement de Au3Stripper ...", $listview) ;; obsolete :( ;; Local $url = "https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/Au3Stripper.exe" Local $url = "http://affz.free.fr/Au3Stripper/Au3Stripper.exe" ; v. 16.306.1237.1 InetGet($url, $exe) If @error Then Return SetError(1, 0, 0) _DatFile($path) EndIf Return $exe EndFunc Func _DatFile($path) Local $datfile = $path & "\Au3Stripper.dat" If not FileExists($datfile) Then Local $data = "Functionname,Parameter to check,0=check for function/1=check for Variable;adlibenable,1,0;" & _ "adlibregister,1,0;adlibunregister,1,0;call,1,0;dllcallbackregister,1,0;eval,1,1;guictrlregisterlistviewsort,2,0;" & _ "guictrlsetonevent,2,0;guiregistermsg,2,0;guisetonevent,2,0;hotkeyset,2,0;isdeclared,1,1;objevent,2,0;" & _ "onautoitexitregister,1,0;onautoitexitunregister,1,0;opt,2,0;traysetonevent,2,0;trayitemsetonevent,2,0;" FileWrite($datfile, StringReplace($data, ";", @crlf)) EndIf EndFunc ViciousXUSMC 1 Link to comment Share on other sites More sharing options...
iamtheky Posted March 19, 2020 Share Posted March 19, 2020 15 minutes ago, mikell said: Sorry for the french language. It's about time someone apologized for it! BrewManNH and seadoggie01 2 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted March 19, 2020 Author Share Posted March 19, 2020 1 hour ago, mikell said: For the fun ...I formerly made for myself a litle tool to do this. It's rough (of course) but maybe it could help Sorry for the french language. It should be understandable thoughPlease be indulgent expandcollapse popup#include <GUIConstantsEx.au3> #include <ListViewConstants.au3> Global Const $__LISTVIEWCONSTANT_WM_SETREDRAW = 0x000B Opt("GUIDataSeparatorChar", ChrW(9617)) $gui = GUICreate("test", 520, 360, -1, 150) $listview = GUICtrlCreateListView("Lignes", 10, 50, 500, 300) GUICtrlSetFont($listview, 8.5, 0, 0, "Tahoma") GUICtrlSendMsg($listview, $LVM_SETCOLUMNWIDTH, 0, 480) GuiCtrlCreateLabel("Ligne à chercher :", 20, 17, 100, 20) $Input = GUICtrlCreateInput("", 110, 15, 40, 20) $Vazi = GUICtrlCreateButton("Charger le script", 180, 15, 120, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $Vazi $n = GuiCtrlRead($Input) ; If $n = "" Then ContinueLoop $au3 = FileOpenDialog("Sélectionner le script à analyser", @scriptdir, "Scripts (*.au3)", 0, "", $gui) If @error Then ContinueLoop $Au3Stripper = _SetAu3Stripper(@tempdir) If @error Then Exit Msgbox(48, "error", "Impossible de charger Au3Stripper") GUICtrlCreateListViewItem("Traitement du script ...", $listview) RunWait('"' & $Au3Stripper & '" "' & $au3 & '" /mergeonly', "", @SW_HIDE) $stripped = StringTrimRight($au3, 4) & "_stripped" & ".au3" $stripped_txt = StringRegExpReplace(FileRead($stripped), '(?m)^\s*#(pragma|include).*\R', "") $lines = StringSplit($stripped_txt, @crlf, 1) GuiCtrlSendMsg($listview, $LVM_DELETEALLITEMS, 0, 0) If $n > $lines[0] Then GUICtrlCreateListViewItem("Le fichier complet n'a que " & $lines[0] & " lignes", $listview) ContinueLoop EndIf GuiCtrlSendMsg($listview, $__LISTVIEWCONSTANT_WM_SETREDRAW, False, 0) For $i = 1 to $lines[0] GUICtrlCreateListViewItem($i & " : " & $lines[$i], $listview) If $i = $n Then GuiCtrlSetColor(-1, 0xdd0000) Next GuiCtrlSendMsg($listview, $__LISTVIEWCONSTANT_WM_SETREDRAW, True, 0) Local $tPoint = DllStructCreate("long X;long Y") GUICtrlSendMsg($listview, $LVM_GETITEMPOSITION, $n-6, DllStructGetPtr($tPoint)) GUICtrlSendMsg($listview, $LVM_SCROLL, DllStructGetData($tPoint, "X"), DllStructGetData($tPoint, "Y")) EndSwitch WEnd Func _SetAu3Stripper($path) Local $exe = $path & "\Au3Stripper.exe" If not FileExists($exe) Then GUICtrlCreateListViewItem("Chargement de Au3Stripper ...", $listview) ;; obsolete :( ;; Local $url = "https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/Au3Stripper.exe" Local $url = "http://affz.free.fr/Au3Stripper/Au3Stripper.exe" ; v. 16.306.1237.1 InetGet($url, $exe) If @error Then Return SetError(1, 0, 0) _DatFile($path) EndIf Return $exe EndFunc Func _DatFile($path) Local $datfile = $path & "\Au3Stripper.dat" If not FileExists($datfile) Then Local $data = "Functionname,Parameter to check,0=check for function/1=check for Variable;adlibenable,1,0;" & _ "adlibregister,1,0;adlibunregister,1,0;call,1,0;dllcallbackregister,1,0;eval,1,1;guictrlregisterlistviewsort,2,0;" & _ "guictrlsetonevent,2,0;guiregistermsg,2,0;guisetonevent,2,0;hotkeyset,2,0;isdeclared,1,1;objevent,2,0;" & _ "onautoitexitregister,1,0;onautoitexitunregister,1,0;opt,2,0;traysetonevent,2,0;trayitemsetonevent,2,0;" FileWrite($datfile, StringReplace($data, ";", @crlf)) EndIf EndFunc Hey that worked! for some reason when I ran it via a cmd I must have done it wrong, this produced the proper lines and I immediately saw why it would fail and why it was a rare occurrence (32bit machines) Link to comment Share on other sites More sharing options...
mikell Posted March 19, 2020 Share Posted March 19, 2020 2 hours ago, iamtheky said: It's about time someone apologized for it! how disappointing... I was sure yet that despite that you would be able to understand the script... iamtheky 1 Link to comment Share on other sites More sharing options...
iamtheky Posted March 19, 2020 Share Posted March 19, 2020 Oh shit no, I rarely have an idea whats going in your scripts, i just copy and paste. Yer where I get all my good string manipulation knowledge, tout cela est grâce a vous. Also, 100% of the french I know is either Tolstoy or vulgar. mikell and seadoggie01 1 1 ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Nine Posted March 19, 2020 Share Posted March 19, 2020 What I like about the script is that "VAZI" function I would have called it SaPaDalurDeDirUnePatentePareil mikell 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
mikell Posted March 20, 2020 Share Posted March 20, 2020 10 hours ago, iamtheky said: Also, 100% of the french I know is either Tolstoy or vulgar. ... just like a significant part of french speaking people - especially for the latter knowledge 10 hours ago, Nine said: I would have called it SaPaDalurDeDirUnePatentePareil for iamtheky : a bit shorter translation could be GufforIt 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