Jump to content

nill

Active Members
  • Posts

    51
  • Joined

  • Last visited

Everything posted by nill

  1. I take this example from help file for autoit $iPID = Run(@ComSpec & ' /U /C DIR "' & $sPath & '\' & $sFileMask & '" /B /S /A-D', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) as it is, it doesn't work, so I converted it to $iPID = Run($file_name_dla_zapuska, @WorkingDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) and it works as I described above, can you just show me your working example?
  2. I read about StdoutRead but still do not understand how sleep() relates to my question
  3. After a little research, I realized that if you run it this way, it goes into the console $iPID = Run(file_name.exe, @WorkingDir, @SW_SHOW) but the output is not written to txt How do I make the logs in the console and then write them in txt?
  4. dont understand why you need full code but there is I think problem in paramets for run() If WinExists('[CLASS:AutoIt v3;TITLE:' & @ScriptName & ']') Or WinExists(@ScriptName & ".exe") Then     ;MsgBox(48, @ScriptName, 'Позволено запускать только одну копию программы!' & @CRLF & @CRLF & 'ОК ==> ВЫХОД')     Exit EndIf AutoItWinSetTitle(@ScriptName) TraySetToolTip(@ScriptName & " v1") #include <Array.au3> #include <Constants.au3> Local $Sleep_posle_vseh_beckapov = 4320;0000 $sOut = '' ; Переменная для хранения вывода StdoutRead. $file_name_dla_zapuska = "NEW_BD_backup.au3" $file_name_dla_zapuska = "NEW_BD_backup.exe" $k=0 While 1     ;For $i = 0 To 2     $iPID1 = Run("Autoit_errror.exe")     ;$iPID = Run(FileGetShortName(@AutoItExe) & " /AutoIt3ExecuteScript " & FileGetShortName($file_name_dla_zapuska), @WorkingDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)     $iPID = Run($file_name_dla_zapuska, @WorkingDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD)     ;$iPID = Run($file_name_dla_zapuska)     ConsoleWrite("WinExists('Autoit_errror.exe')=" & WinExists('Autoit_errror.exe') & @CRLF)          ;$iPID = Run(@ComSpec & ' /U /C DIR "' & $sPath & '\' & $sFileMask & '" /B /S /A-D', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)     ;ConsoleWrite("$i =" & $i & @CRLF)     $log_count = 0     $n = 0     While 1         $n = $n + 1         ;$sOut &= StdoutRead($iPID, False)         $time = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC         ConsoleWrite($time&" 1log posle =" & $n & " " & @error & @CRLF)         ;ConsoleWrite("log posle =" & $sOut & @CRLF)         Sleep(15000)         If WinExists('[CLASS:AutoIt v3;TITLE:' & $file_name_dla_zapuska & ']') = 0 Then             Sleep(1000)             $sOut &= StdoutRead($iPID, False)             Sleep(5000)                          $time = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC             ConsoleWrite($time&" Console_logs_from_NEW_BD_backup =" & $sOut & @CRLF)             If $log_count < 500 Then                 $hFile = FileOpen("Console_logs_from_NEW_BD_backup.txt", 1)             Else                 $hFile = FileOpen("Console_logs_from_NEW_BD_backup.txt", 2)                 $log_count = 0             EndIf                      FileWrite($hFile, $time & @CRLF & $sOut & @CRLF & @CRLF & "=====================================================================================================================================================================" & @CRLF)             FileClose($hFile)             ExitLoop         EndIf     WEnd     $k=$k+1     $time = @YEAR & "/" & @MON & "/" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC     ConsoleWrite($k&" "&$time&" Sleep_posle_vseh_beckapov start =" & $Sleep_posle_vseh_beckapov&" milliseconds" & @CRLF& @CRLF)     Sleep($Sleep_posle_vseh_beckapov) WEnd ;Next
  5. In the exe I wrote #pragma compile(Console, true) If I run it separately it works and logs are written But I execute it from other script autoit, and console window opens, but no logs. $iPID = Run(file_name.exe, @WorkingDir, @SW_SHOW, $STDERR_CHILD + $STDOUT_CHILD) This is needed to read everything that is printed to the console into a separate variable $sOut &= StdoutRead($iPID, False)
  6. only StringRegExp($sTxt, '(?m).+', 3) helps, thanks!
  7. I mean each line I cant copy exactly what I have in VS Console I showed it on the screenshot above, when I copy I got this And I intresting to get line where I have 0 (zero)
  8. in real console (I use VS Code) I have a problem that i got I want to get a zero, which in the screenshot is shown on a separate line (this is the result of the command echo $? in the console) but as you can see a bunch of extra characters are written to the array, although there are none in the autoit console in a regular console (not autoit) this command looks like this
  9. I get the following result in a variable how do I split this up so I get each string a separate array element using _StringExplode()
  10. Yea you are right I used another string for checking
  11. It doesn't work or I don't understand something I got $aMatches=1 Not array
  12. Using $text = StdoutRead($_plinkhandle) I get the text from the console like this echo $? 0 How can I process this text in autoit to read what value comes after $? ignoring the line feed ?
  13. Is it possible to change the text when hovering over the tray icon for an exe or autoit script ? Now when hovering the mouse always writes the name of the running file, that is, I run test.exe or test.au3 when hovering over the tray icon it says test.exe or test.au3
  14. I use Autoit plagin from Damien in VS Code I can't find any compile button
  15. it works! but I cant see the log in output console for NEW_BD_backup.au3 I see only this
  16. Please give an example of launching what you are talking about ?
  17. After installing and creating Main_backup.au3, I try to run any autoit script press Ctrl + Alt + N writes me [Running] autoit3 "c:\Autoit_code\Main_backup.au3" "autoit3" �� ���� ����७��� ��� ���譥� ��������, �ᯮ��塞�� �ணࠬ��� ��� ������ 䠩���. [Done] exited with code=1 in 0.179 seconds my code was ConsoleWrite("$kk=" @CRLF) $kk=Run("NEW_BD_backup.au3") ConsoleWrite("$kk=" & $kk & @CRLF) Main_backup.au3 and NEW_BD_backup.au3 in the same directory the file NEW_BD_backup.au3 definitely does not start it creates new files in the folder, and they are not there
  18. 1) I need the autoit script to periodically run another autoit script through VS Code to see all the logs, how to do it ? 2) If it is possible to do this, will all logs in console OUTPUT saved in VS Code or I will see only the last attempt to run?
  19. Yes it is. Now all works. Thanks)
  20. I have tidy.exe installed I set a keyboard shortcut to run Autoit tidy, a lot of entries appeared in the Output logs and they go for a very long time, but the code was not formatted, nothing was aligned
  21. When I press F5 in VS Code for Autoit code, the script is restarted and all logs from the bottom OUTPUT console disappear Prohibiting the launch of only one copy of the script does not help, still in OUTPUT are written logs for a new attempt to run, and the old running script disappears, although it continues to run. Is it possible to return to the logs of the first running script so that it also writes everything it does in OUTPUT ?
  22. I dont have any command for autoit
  23. I use Autoit plagin from Damien in VS Code When I press Shift + Alt + F I got message: There is no formatter for autoit And there is no extention when I searh category:formatters autoit
  24. give me the link please
  25. Have downloaded and installed AutoIt and AutoIt Script Editor also I installed plugin AutoIt Damien I can run scripts by pressing the F5 But If I try Run->Run Without Debugging or Run->Start Debugging I have an error You don't have an extension for debugging autoit How I can fix this or how can I run the autoit from the VS code menu ?
×
×
  • Create New...