ayu_2403 Posted June 22, 2023 Share Posted June 22, 2023 I am running a autoit script from the command prompt. But on running "C:\Program Files (x86)\AutoIt3\autoit3_x64.exe " & "c:\Users\opc\Desktop\AutoIt\Test_Copy.au3" the script is executing in the background and the command line exits. I want the command prompt to show execution of the script and act as a console so that whatever i write in ConsoleWrite function gets printed to the command prompt. Link to comment Share on other sites More sharing options...
ioa747 Posted June 22, 2023 Share Posted June 22, 2023 Runs an external program and pauses script execution until the program finishes RunWait ( "program" [, "workingdir" [, show_flag [, opt_flag]]] ) if you want to interact with cmd take a look intopic/126569-consoleau3-udf I know that I know nothing Link to comment Share on other sites More sharing options...
Andreik Posted June 22, 2023 Share Posted June 22, 2023 (edited) You can have something like that for scripts that are not compiled. "C:\Program Files (x86)\AutoIt3\autoit3_x64.exe" "c:\Users\opc\Desktop\AutoIt\Test_Copy.au3" | more Edited June 22, 2023 by Andreik Link to comment Share on other sites More sharing options...
ayu_2403 Posted June 22, 2023 Author Share Posted June 22, 2023 7 minutes ago, Andreik said: You can have something like that for scripts that are not compiled. "C:\Program Files (x86)\AutoIt3\autoit3_x64.exe" "c:\Users\opc\Desktop\AutoIt\Test_Copy.au3" | more when i run this it pauses command prompt but the console output are not printed sequentially they all are printed at once. for example if i run the below script "hello" and "execution finished" are not printed at an interval of 10 sec but printed ate simultaneously after 10 sec. ConsoleWrite("hello") Sleep(10000) ConsoleWrite("Execution Finished") Link to comment Share on other sites More sharing options...
Andreik Posted June 22, 2023 Share Posted June 22, 2023 (edited) That's true and it's because the output of the script is not redirected until you send the end of line. If you don't like this behavior just compile the script as executable. This could be fix like this: ConsoleWrite("hello" & @crlf) Sleep(10000) ConsoleWrite("Execution Finished") Edited June 22, 2023 by Andreik Link to comment Share on other sites More sharing options...
ayu_2403 Posted June 22, 2023 Author Share Posted June 22, 2023 9 minutes ago, Andreik said: That's true and it's because the output of the script is not redirected. If you don't like this behavior just compile the script as executable. I have converted it into exe file and running using this command "C:\Users\opc\Desktop\AutoIt\RunTest.exe" | more but no changes, hello and execution finished are printed simultaneously. Link to comment Share on other sites More sharing options...
Andreik Posted June 22, 2023 Share Posted June 22, 2023 (edited) If you compile from SciTE just add this directive in the beginning of the script. #AutoIt3Wrapper_Change2CUI=y PS: In compiled scripts you don't need to use | more and you are not enforced to use CRLF to output the console buffer. Edited June 22, 2023 by Andreik ayu_2403 1 Link to comment Share on other sites More sharing options...
ayu_2403 Posted June 22, 2023 Author Share Posted June 22, 2023 39 minutes ago, Andreik said: That's true and it's because the output of the script is not redirected until you send the end of line. If you don't like this behavior just compile the script as executable. This could be fix like this: ConsoleWrite("hello" & @crlf) Sleep(10000) ConsoleWrite("Execution Finished") adding @CRLF does the work😀. Thanks @Andreik 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