Return string to cmd screen from compiled .exe AHK script Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
aircooled
Posts: 79
Joined: 01 Dec 2018, 08:51

Return string to cmd screen from compiled .exe AHK script

12 Sep 2019, 05:35

I need to return a string like ABCD:1234;DEFG;5678 to the calling environment from a compiled .exe file.

I am using AHK v. 1.1.30.1

I execute the .exe in cmd and wish it to return the value to screen.

I have tried:
return
ExitApp
ExitCode (it whould be possible to return an expression from this)
StrPut

with no success until now. I need it to return the value the same way a .bat file in cmd would return the command "echo ABCD:1234;DEFG;5678"

my compiled ahk file is performing an amount of functionality which results in a string that I need written to screen. Is it possible?
aircooled
Posts: 79
Joined: 01 Dec 2018, 08:51

Re: Return string to cmd screen from compiled .exe AHK script

12 Sep 2019, 16:43

Is there really nobody that can help how to make an .exe compiled ahk file return a string when executed in console?

My AHK .exe file performs some logic and returns the results in the form of a semicolon separated string.

Something like

34223423;23423545;234234

Is it possible to have the .exe file return that when executed in cmd console?

The same way a .bat file returns with "echo 34223423;23423545;234234"

Please help.

Thank you.
ilhom
Posts: 52
Joined: 19 Aug 2019, 17:58

Re: Return string to cmd screen from compiled .exe AHK script

12 Sep 2019, 16:59

Can check to see if the command console is active through IfWinActive and then input the string.
https://www.autohotkey.com/docs/commands/WinActive.htm

So if console isn't active, it runs however you have it running now.
If console is active, you can send the input as text so you can see the command in the console just like @echo in .bat files.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Return string to cmd screen from compiled .exe AHK script

12 Sep 2019, 18:18

Perhaps you want this:

To write:
FileAppend with * (stdout) or ** (stderr):
FileAppend - Syntax & Usage | AutoHotkey
https://www.autohotkey.com/docs/commands/FileAppend.htm

To read:
ExecScript example code to receive stdout/stderr:
Run / RunWait - Syntax & Usage | AutoHotkey
https://www.autohotkey.com/docs/commands/Run.htm
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
aircooled
Posts: 79
Joined: 01 Dec 2018, 08:51

Re: Return string to cmd screen from compiled .exe AHK script  Topic is solved

15 Sep 2019, 23:42

Thank you all. This did the trick:

Fileappend:
Standard Output (stdout): Specifying an asterisk (*) for Filename causes Text to be sent to standard output (stdout).

Easier than I thought. :dance:

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], jadams and 41 guests