Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/11/2020 in all areas

  1. Hi Exit and thanks ! I have now tested and that works perfect without any problems.
    1 point
  2. Problem solved. New version in first post. Have fun.
    1 point
  3. Ok thanks I beeing wait and see what you can do so it works on 32 bit's windows.
    1 point
  4. Hi Exit please check the console aoutput file. debug.txt
    1 point
  5. Possibly the Fastest 64Bit Bitwise NOT ever: Func _NotABit($iInt) Return -$iInt-1 EndFunc
    1 point
  6. If want faster results, you could use MAP (see beta version) : Const $mypath = @ScriptDir Local $aFiles = _FileListToArray($mypath, "*.txt", $FLTA_FILES) Local $mWord[] ; create map array Local $aWords For $i = 1 To $aFiles[0] $aWords = StringRegExp(FileRead($aFiles[$i]), "[^\s]+", 3) ; change pattern to fit your definition of "word" If Not IsArray($aWords) Then ContinueLoop For $Word In $aWords $mWord[$Word] = 1 Next Next $aWords = MapKeys($mWord) ConsoleWrite (UBound($aWords) & @CRLF)
    1 point
  7. Siwa, Both of those functions should work - although it is certain that _BlockReDraw could interfere with showing the results. You do turn redrawing back on again later? But as always I need a short reproducer script so that I can debug - without that there is not a lot I can do. M23
    1 point
  8. Someone told me I should post this in the examples section. I wrote this to make it easy for me to call a Windows console application and get its output using a single line of AutoIt code. I hope it's helpful to someone else. #include <Constants.au3> ; Examples: MsgBox(0,"Windows Version",_RunWaitGet(@ComSpec & " /c ver",1,"",@SW_HIDE)) MsgBox(0,"System Info",_RunWaitGet(@SystemDir & "\systeminfo.exe",1)) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _RunWaitGet ; Description ...: Runs the specified process, waits for it to exit, then returns the contents of its StdOut and/or StdErr streams. ; Handy for running command-line tools and getting their output. ; Syntax ........: _RunWaitGet($sProgram, $nOptions, $sWorkingDir, $nShowFlag) ; Parameters ....: $sProgram - The full path of the program (EXE, BAT, COM, or PIF) to run ; $nOptions - Add options together: ; 1 = Capture the StdOut stream. ; 2 = Capture the StdErr stream. ; 4 = Return when the stream(s) close(s), not when the process ends. ; $sWorkingDir - The working directory. Blank ("") uses the current working directory. ; This is not the path to the program. ; $nShowFlag - The "show" flag of the executed program: ; @SW_SHOW = Show window (default) ; @SW_HIDE = Hidden window (or Default keyword) ; @SW_MINIMIZE = Minimized window ; @SW_MAXIMIZE = Maximized window ; Return values .: String value containing the captured contents. ; If there was a problem running the process, @error is set to the @error value returned by Run(). ; Otherwise, @error is 0. ; Author ........: ToasterKing ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: MsgBox(0,"System Info",_RunWaitGet(@SystemDir & "\systeminfo.exe",1)) ; MsgBox(0,"Windows Version",_RunWaitGet(@ComSpec & " /c ver",1,"",@SW_HIDE)) ; =============================================================================================================================== Func _RunWaitGet($sProgram,$nOptions = 0,$sWorkingDir = @SystemDir,$nShowFlag = @SW_SHOW) Local $nRunOptFlags = 0,$sStreamOut = "" ; Initialize variables ; Determine flags for parent/child interaction If BitAND($nOptions,1) Then $nRunOptFlags += $STDOUT_CHILD If BitAND($nOptions,2) Then $nRunOptFlags += $STDERR_CHILD Local $hRunStream = Run($sProgram,$sWorkingDir,$nShowFlag,$nRunOptFlags) ; Run the process If @error Then Return SetError(@error,@extended,0) ; If there was an error code, return it. Otherwise... While 1 ; Loop until the end of the stream, which indicates that the process has closed it (which usually means the process ended) If BitAND($nOptions,1) Then ; If user specified to capture STDOUT stream... $sStreamOut &= StdoutRead($hRunStream) ; Append new stream contents to existing variable while removing those contents from the stream. If @error = 2 And BitAND($nOptions,4) Then ExitLoop ; If stream ended and user specified to return when the stream closes, stop looping. EndIf If BitAND($nOptions,2) Then ; If user specified to capture STDERR stream... $sStreamOut &= StderrRead($hRunStream) ; Append new stream contents to existing variable while removing those contents from the stream. If @error = 2 And BitAND($nOptions,4) Then ExitLoop ; If stream ended and user specified to return when the stream closes, stop looping. EndIf If Not BitAND($nOptions,4) And Not ProcessExists($hRunStream) Then ExitLoop ; If using the default setting and the process ended, stop looping. Sleep(100) ; To avoid overloading the CPU WEnd Return SetError(0,0,$sStreamOut) ; Return the captured contents and @error = 0 EndFunc
    1 point
×
×
  • Create New...