edoroom Posted July 5, 2022 Share Posted July 5, 2022 (edited) Hi, I'm not entirely sure if it's due to the _filelisttoarray or if it's the way I made this function to work, the script it self that crashing is around 3000 lines so no point writing it down, according to the log I'm writing during the stages of the script when this crash happen it's always when it's getting to a point where I call a "timeout" function where I check a folder every sec to see if a file arrived and if so to stop the progress bar and continue the script.. Maybe using the filelisttoarray every sec might cause this crash? I can say this crash happened to me already 3 times out of around 20-30 runs, not sure if it's if how I wrote it or something really wrong here.. expandcollapse popupFunc _timeout25($i) Local $script = IniRead(@ScriptDir&"\"&"config.ini", "Config of DICOM Tags script", "Script", "0") Local $auto = IniRead(@ScriptDir&"\"&"config.ini", "Automode", "Auto", "0") ;~ _writelog("timeout_log1") Local $outputword = "" Local $DirArray = "" Local $mm = 0 Local $timeout = 0 Local $emptycheck = "" If $auto = 0 Then $exitdelaymsg = "" ;~ _writelog("timeout_log2") Else $exitdelaymsg= IniRead(@ScriptDir&"\"&"config.ini", "Automode", "Exitdelay", "3600") ;~ _writelog("timeout_log3") EndIf Switch $script case 0,1 $emptycheck = "C:\Results\Store\" ;~ _writelog("timeout_log4") $DirArray = _FileListToArray($emptycheck, "*", Default, True) ;~ _writelog("timeout_log5") $outputword = "Store" $mm=$i+1 case 2 $emptycheck = "C:\Results\MPPS\" ;~ _writelog("timeout_log4") $DirArray = _FileListToArray($emptycheck, "*", Default, True) ;~ _writelog("timeout_log5") $outputword = "MPPS" $mm=($i+1)*2 case 3 $emptycheck = "C:\Results\RDSR\" ;~ _writelog("timeout_log4") $DirArray = _FileListToArray($emptycheck, "*", Default, True) ;~ _writelog("timeout_log5") $outputword = "RDSR" $mm=$i EndSwitch WinActivate("Chameleon") ProgressOn("Timer", "25 Sec Timeout till .dcm received" & @CRLF & "..." , "0sec", -1, -1, BitOR($DLG_NOTONTOP, $DLG_MOVEABLE)) WinActivate("Timer","") ; Update the progress value of the progress bar window every second. For $timeout = 0 To 100 Step 4 Sleep(1000) ;~ _writelog("timeout_log6_"&$timeout) ProgressSet($timeout, $timeout/4 & "sec") $DirArray = _FileListToArray($emptycheck, "*", Default, True) ;~ _writelog("timeout_log7") If UBound($DirArray)-2 = $mm Then ProgressSet(100, "Timer", "Timeout ended") _WriteLog("Timeout ended, .dcm exists!") $timeout = 100 EndIf Next Sleep(1500) ProgressSet(100, "Timer", "Timeout ended") ;~ _writelog("timeout_log8") ; Close the progress window. ProgressOff() Sleep(1000) If UBound($DirArray)-2 <> $mm Then _ScreenCapture_Capture($LOG_PATH&$screencapture& "_" & @HOUR & "_" & @MIN & "_" & @SEC & "_timeout.jpg") $screencapture = $screencapture+1 _WriteLog("Error! "&$outputword&" .dcm file wasnt sent!! ") _WriteLog("Pausing script till manual check for issues.") If MsgBox(4, "Manual Check Required", "Error! "&$outputword&" .dcm wasnt sent, check queue and check if any error shows..? Yes to continue script, No to exit script.",$exitdelaymsg) = 6 Then _WriteLog("Continue script after manual check for errors...") Else _WriteLog("Exit script...") _writelog("Possible Exception - Script failed during Study -> Worklist (.DCM Missing)") Exit 7 EndIf EndIf EndFunc I k now this code could be a bit better but it's doing it's job, I call this function with number of files to check ($i) starting with 1... 2... and so on. Quote Faulting application name: dicomscript.exe, version: 0.0.0.0, time stamp: 0x62c2cbe9 Faulting module name: dicomscript.exe, version: 0.0.0.0, time stamp: 0x62c2cbe9 Exception code: 0xc0000005 Fault offset: 0x000826aa Faulting process id: 0x2200 Faulting application start time: 0x01d88fffa529d0c1 Faulting application path: C:\dicomtags\dicomscript.exe Faulting module path: C:\dicomtags\dicomscript.exe Report Id: fe395dba-0381-4615-bfc1-962b9b923d0e Faulting package full name: Faulting package-relative application ID: Not much explanation in the event viewer except for the exception code, any idea? *I also did run just Today this function alone around 50 times just to see if it's something that happening and all went okay.. so not quite sure what's happening since it's coming randomly and rare.. my only question here is if it's something due to how I wrote that function which might take resources as time goes or dunno..* The part from the main script where I call that function is for example - For $i = 0 To $amount ; number of patients ;doing some stuff....calling functions that doing some recorded clicks... ;and I end it with _WriteLog("Closing visit") _closeVisit() ;sends the image to DICOM automatically in DRF _writelog("25 Sec timeout to let Queue manager to send .dcm file") _timeout25($i) ;check if store dcm was sent, if not report error and wait for user to check what's going in.. _WriteLog("Ending Patient Num: " & $i+1 & " Out of "&$amount+1) Next So for example when the crash happen and I check my logs I see it's always getting to the part where it says "25 sec timeout to let queue manager to send .dcm file" and there the crash happening, which means the script didnt get yet to the function part where it's doing the progressbar as there I write to the log that the timeout started, so it's somewhere before.. not sure why ;/ Edited July 5, 2022 by edoroom more info Link to comment Share on other sites More sharing options...
abberration Posted July 5, 2022 Share Posted July 5, 2022 If it writes to the log about 25 sec timeout, then the next line, the _timeout25 function, is that where it's crashing? When it crashes, do you get an AutoIt error message? Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
edoroom Posted July 5, 2022 Author Share Posted July 5, 2022 3 minutes ago, abberration said: If it writes to the log about 25 sec timeout, then the next line, the _timeout25 function, is that where it's crashing? When it crashes, do you get an AutoIt error message? Hi, Yes that's correct, it writes the 25 sec timeout to the log which means the crash happens when it's going to the _timeout25 function, somewhere there ;/ No autoit error message no nothing, I can only find out about this crash by checking event viewer where there is "Application Error" error saying what I quoted there Link to comment Share on other sites More sharing options...
rudi Posted July 8, 2022 Share Posted July 8, 2022 (edited) put these lines below every occurence of _FileListToArray() MsgBox(0, $Emptycheck, "VarType $DirArray = " & VarGetType($DirArray) & @CRLF & _ "@error = " & @error & @CRLF & _ "0 - success" & @CRLF & _ "1 - Folder not found or invalid" & @CRLF & _ "2 - Invalid $sFilter" & @CRLF & _ "3 - Invalid $iFlag" & @CRLF & _ "4 - No File(s) Found") Edited July 8, 2022 by rudi <typo> Earth is flat, pigs can fly, and Nuclear Power is SAFE! Link to comment Share on other sites More sharing options...
edoroom Posted July 10, 2022 Author Share Posted July 10, 2022 On 7/8/2022 at 3:04 PM, rudi said: put these lines below every occurence of _FileListToArray() MsgBox(0, $Emptycheck, "VarType $DirArray = " & VarGetType($DirArray) & @CRLF & _ "@error = " & @error & @CRLF & _ "0 - success" & @CRLF & _ "1 - Folder not found or invalid" & @CRLF & _ "2 - Invalid $sFilter" & @CRLF & _ "3 - Invalid $iFlag" & @CRLF & _ "4 - No File(s) Found") Thanks I will try to catch it again with it (I will just change it from msgbox to log file) I doubt it would be an error that autoit will find as it seems it's something that stopping the whole run and not a defined error but let's see next time it will happen. 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