
nill
Active Members-
Posts
51 -
Joined
-
Last visited
Everything posted by nill
-
How to run an exe to write logs in the console
nill replied to nill's topic in AutoIt General Help and Support
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? -
How to run an exe to write logs in the console
nill replied to nill's topic in AutoIt General Help and Support
I read about StdoutRead but still do not understand how sleep() relates to my question -
How to run an exe to write logs in the console
nill replied to nill's topic in AutoIt General Help and Support
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? -
How to run an exe to write logs in the console
nill replied to nill's topic in AutoIt General Help and Support
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 -
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)
-
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
-
Yea you are right I used another string for checking
-
It doesn't work or I don't understand something I got $aMatches=1 Not array
-
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 ?
-
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
-
I use Autoit plagin from Damien in VS Code I can't find any compile button
-
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
-
How to format autoit code in VS Code - (Moved)
nill replied to nill's topic in AutoIt Technical Discussion
Yes it is. Now all works. Thanks) -
How to format autoit code in VS Code - (Moved)
nill replied to nill's topic in AutoIt Technical Discussion
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 -
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 ?
-
How to format autoit code in VS Code - (Moved)
nill replied to nill's topic in AutoIt Technical Discussion
-
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
-
give me the link please
-
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 ?