echo text to console where it run

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
jkeks
Posts: 60
Joined: 20 Oct 2019, 00:24
Contact:

echo text to console where it run

Post by jkeks » 20 Feb 2023, 01:48

FileAppend ("asdas","*") - dont work
is there any way to print something to console where it run ?


[Mod edit: Topic moved from ''AHK v2 Development. Please use 'Ask For Help v2' for help requests like this.]

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: echo text to console where it run

Post by swagfag » 20 Feb 2023, 04:49

dont insert spaces before the parens

jkeks
Posts: 60
Joined: 20 Oct 2019, 00:24
Contact:

Re: echo text to console where it run

Post by jkeks » 20 Feb 2023, 10:56

swagfag wrote:
20 Feb 2023, 04:49
dont insert spaces before the parens
image.png
image.png (7.91 KiB) Viewed 765 times
can you give me correct example ?

Code: Select all

#Requires AutoHotkey v2.0
FileAppend ( "asdas" , "*" )

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: echo text to console where it run

Post by swagfag » 20 Feb 2023, 11:12

yes, the correct example is
swagfag wrote:
20 Feb 2023, 04:49
dont insert spaces before the parens
i dont understand why u took this to mean "insert an extra set of parens"......

jkeks
Posts: 60
Joined: 20 Oct 2019, 00:24
Contact:

Re: echo text to console where it run

Post by jkeks » 20 Feb 2023, 23:38

swagfag wrote:
20 Feb 2023, 11:12
yes, the correct example is
swagfag wrote:
20 Feb 2023, 04:49
dont insert spaces before the parens
i dont understand why u took this to mean "insert an extra set of parens"......
Take example from official site
image.png
image.png (5.3 KiB) Viewed 705 times

Code: Select all

#Requires AutoHotkey v2.0
FileAppend "asdas", "*"
Result: Incorrect desciptor
image.png
image.png (22.28 KiB) Viewed 705 times

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: echo text to console where it run

Post by swagfag » 25 Feb 2023, 14:04

use

Code: Select all

DllCall("AttachConsole", "UInt", ATTACH_PARENT_PROCESS := -1)

User avatar
thqby
Posts: 433
Joined: 16 Apr 2021, 11:18
Contact:

Re: echo text to console where it run

Post by thqby » 25 Feb 2023, 22:26

Filename
Type: String
The name of the file to be appended, which is assumed to be in A_WorkingDir if an absolute path isn't specified. The destination directory must already exist.
Standard Output (stdout): Specifying an asterisk (*) for Filename causes Text to be sent to standard output (stdout). Such text can be redirected to a file, piped to another EXE, or captured by fancy text editors. For example, the following would be valid if typed at a command prompt:
"%ProgramFiles%\AutoHotkey\AutoHotkey.exe" "My Script.ahk" >"Error Log.txt"
However, text sent to stdout will not appear at the command prompt it was launched from. This can be worked around by 1) compiling the script with the Ahk2Exe ConsoleApp directive, or 2) piping a script's output to another command or program. For example:
"%ProgramFiles%\AutoHotkey\AutoHotkey.exe" "My Script.ahk" |more
For /F "tokens=*" %L in ('""%ProgramFiles%\AutoHotkey\AutoHotkey.exe" "My Script .ahk""') do @Echo %L
Specifying two asterisks (**) for Filename causes Text to be sent to the standard error stream (stderr).
"%ProgramFiles%\AutoHotkey\AutoHotkey.exe" "2.ahk" |more

Post Reply

Return to “Ask for Help (v2)”