Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Run() Freezing After Looping 43 Times

$
0
0
Hello, I'm running into an issue with the Run() command. I'm calling it from within two loops and it semi randomly freezes. It usually works though if I limit the inner loop to only run 43 times (yes, 43, not 44). I'm rather lost and confused about it. Maybe it's just a limitation that I don't know about. I even tried adding a wait(5000) every 10 loops, but it still freezes.

The scenario that I'm testing this involves the user selecting a folder which contains multiple subfolders. Each subfolder has numerous xml files in it.

/Root
3 Folders

/Root/Subfolder1
253 xml Files

/Root/Subfolder2
91 xml files

/Root/Subfolder3
31 xml files


Populating column 1 and 2 work fine, but column 3 is the result of calling _password().  The function is in xpath.au3 and it's that function which is causing me troubles.

I'd greatly appreciate any help, this is my first autoit script and I did try and research this problem.

I found the LimitsDefaults list in the documentation and I'm not certain from reading that if I'm reaching one of them.

An oddity that is worth pointing out is, there is two loops, and if parent loop can run 3 times (one for each subfolder) and as long as the inner is set to only run 43, all 3 parent loops work like a charm.


Main Script
[ autoit ]         
#include <File.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> #include <xpath.au3> $mainwindow = GUICreate("Form1", 789, 646, 192, 124) $Openbtn = GUICtrlCreateButton("Open", 32, 8, 97, 25) $listview = GUICtrlCreateListView("Server              |Channel Name                      |Password  ", 24, 72, 737, 539) $Progress1 = GUICtrlCreateProgress(144, 8, 617, 25) GUISetState(@SW_SHOW) While 1     $nMsg = GUIGetMsg()     Select         Case $nMsg = $GUI_EVENT_CLOSE             Exit          Case $nMsg = $Openbtn             $OpenDialog = FileSelectFolder ("Select Mirth Root", @WorkingDir)             if @error Then                MsgBox(4096,"","No folder chosen")             Else                $OpenDialog = StringReplace($OpenDialog, "|", @CRLF)                $FileListArray = _FileListToArray($OpenDialog,"*",2)                For $i = 1 To $FileListArray[0]                   $directory = $OpenDialog & "\" & $FileListArray[$i]                   $subfilesArray = _FileListToArray($directory, "*.xml")                     ;Run() doesn't freeze if I change the loop to stop at 43. And it'll run through the parent loop multiple times still.                     ;For $a = 1 To 43                     For $a = 1 to $subfilesArray[0]                         $file= $directory & "\" & $subfilesArray[$a]                         $password = _password($file)                         GUICtrlCreateListViewItem($a & " " & $FileListArray[$i] & "|" & StringReplace($subfilesArray[$a],".xml","") & "|" & $password ,$listview)                     Next                            Next             EndIf     EndSelect WEnd

xpath.au3

[ autoit ]         
#include <Constants.au3> #include <Process.au3> Func _password($file) $cmds = "sel -t -v //property[@name='password'][last()] " & """" & $file & """" Local $foo = Run(@WorkingDir & "\xml.exe " & $cmds, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) ;This script still freezes even if I'm not running xml.exe ("echo hi" for example). It freezes after 43 runs on JUST the innerloop from the main au3. ;Local $foo = Run(@ComSpec & " /c echo hi", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $line While 1 $line &= StdoutRead($foo) ; change 1 If @error Then ExitLoop Wend While 1 $line &= StderrRead($foo) ; change 2 If @error Then ExitLoop Wend    return $line EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>