Printing to the console / command line

I want to write text to the console / Windows command line in AutoIt. I ran a test script as shown below:

Func Test()
   ConsoleWrite("Hello")
EndFunc

Test()

I saved the script as test.au3. When I run it, it does not print to the console. I checked ConsoleWrite(); it should print to the DOS console if it is script compiled as a console application.

I compiled a script using Aut2Exe. It still does not print to the console. How to write in the console in AutoIt?

+4
source share
3 answers

Just compile test.au3 as follows:

%PathToAutoItVersion%\Aut2Exe\Aut2exe.exe /in test.au3 /out test.exe /console

And then you can run test.exeand print:

hello
+4
source

script:

#pragma compile(Console, True) 
+4

AutoIt?

- - ConsoleWrite():

- STDOUT. & Hellip; , , STDOUT.

script .au3 , :

  • F5 ( > ) . :

    enter image description here

  • Ctrl + F7 ( > ), Create CUI instead of GUI EXE., Compile Script .

  • #AutoIt3Wrapper_Change2CUI=Y (or #pragma compile(Console, True)) script, F7 ( > ) .
  • :
    ...\AutoIt3\Aut2Exe\Aut2exe.exe /in ...\script.au3 /out ...\script.exe /console .

script Aut2Exe. .

. :

#AutoIt3Wrapper_Change2CUI=Y

Global Enum  $EXITCODE_OK
Global Const $g_sMsg   = 'Hello, World!' & @CRLF
Global Const $g_iDelay = 1000 * 10

Main()

Func Main()

    ConsoleWrite($g_sMsg)
    Sleep($g_iDelay)

    Exit $EXITCODE_OK
EndFunc

: .

0

Source: https://habr.com/ru/post/1624061/


All Articles