Page 1 of 1

LibCon - AutoHotkey Library For Console Support

Posted: 30 Sep 2013, 07:51
by joedf
 LibCon - AutoHotkey Library For Console Support
__________________________________________________________________________________________________
The main goal of this library is to maintain simplicity, so that the common AutoHotkey user may use it and integrate it easily. Image
I know that this is probably considered far from complete, but just to get things started, here it is!
See the Documentation here. See some Examples here.

LibCon is proudly under the MIT License.


Image

Contact Me for Requests, Comments, Contributions, etc.
__________________________________________________________________________________________________

Get it from GitHub Here or Direct Download

Re: LibCon - AutoHotkey Library For Console Support

Posted: 30 Sep 2013, 12:49
by Alibaba
Wow, this looks awesome!
I never saw it in the old forum...

Re: LibCon - AutoHotkey Library For Console Support

Posted: 30 Sep 2013, 19:57
by joedf
Oh! Really! Oh well there you go! Hope you enjoy it as much as I do :D

Re: LibCon - AutoHotkey Library For Console Support

Posted: 01 Oct 2013, 11:38
by Alibaba
joedf wrote:Oh! Really! Oh well there you go! Hope you enjoy it as much as I do :D
Currently i don't have any usage for it sadly. :(
But few months ago i exactly looked for something like this. :D

Well let's see. If i need it, i know where it is. :)

Re: LibCon - AutoHotkey Library For Console Support

Posted: 01 Oct 2013, 17:20
by joedf
im open to all suggestions ^__^

Re: LibCon - AutoHotkey Library For Console Support

Posted: 05 Mar 2015, 21:12
by BGM
JoeDF, I'm trying to figure this out.

Say I want to send the "dir" command.
So I use
puts("dir")
and it prints "dir" in the console, now

Re: LibCon - AutoHotkey Library For Console Support

Posted: 05 Mar 2015, 21:25
by BGM
Joe, I want to send text to the console and read back the results.
So if I send "ping outlook.com -n 1" - I want to see that in the console and fetch back the output to display in my edit box.

It seems that libCon does not contain a wrapper for WriteConsoleInput.
https://msdn.microsoft.com/en-us/librar ... s.85).aspx

Re: LibCon - AutoHotkey Library For Console Support

Posted: 06 Mar 2015, 01:00
by Soft
niceeeeeee!!

Re: LibCon - AutoHotkey Library For Console Support

Posted: 06 Mar 2015, 02:04
by joedf
You can use ReadConsoleOutput( x, y, w, h )
http://joedf.github.io/libcon/LibCon_do ... t-x-y-w-h-
Let me know if you need an example. :)

Re: LibCon - AutoHotkey Library For Console Support

Posted: 06 Mar 2015, 09:26
by BGM
Joe, well, I can't get to the point of using ReadConsoleOutput because I can't figure out how to get the CLI to run the command I send it. All I can get it to do is to print text in the window.

How can I send the console a command to run? I would be wont to look for SetConsoleInput or something.... but there is only SetConsoleInputCP.

Re: LibCon - AutoHotkey Library For Console Support

Posted: 06 Mar 2015, 17:15
by joedf
here's an example :

Code: Select all

#SingleInstance,Off
#Include LibCon.ahk ;Needed
#NoTrayIcon ;Suggested
SetBatchLines,-1 ;suggested
LibConDebug:=1 ;let the user know about errors

SmartStartConsole() ;Shows the Console and 'initializes' the library
;<<<<<<<<  HEADER END  >>>>>>>>>

runwait, ping 8.8.8.8
newline(2)
string := ReadConsoleOutput(0,0,79,12)
MsgBox % string
exitapp
;)

Re: LibCon - AutoHotkey Library For Console Support

Posted: 03 Jul 2015, 02:58
by T_Lube
Would this work in a SQLite3 shell window? How I just posted a topic on this and i would really like to figure out how to do it as quickly as possible. I know that this is an old post, but hopefully this gets eom hits again.

Re: LibCon - AutoHotkey Library For Console Support

Posted: 03 Jul 2015, 09:52
by joedf
The point of the library is that you have the power of actually creating the shell window itself!
So you could combine an SQL library and libcon.ahk and recreate the mysql prompt if you wanted ;)

Re: LibCon - AutoHotkey Library For Console Support

Posted: 01 Feb 2019, 15:44
by Delta Pythagorean
I know this is quite the old topic, but would anyone here know how I can continue to use an ActiveX control without it freezing/crashing because of a "read input" command causing the whole script to freeze?

Re: LibCon - AutoHotkey Library For Console Support

Posted: 01 Feb 2019, 16:21
by joedf
Possibly show some code? ;)

Re: LibCon - AutoHotkey Library For Console Support

Posted: 20 Feb 2019, 11:46
by BGM
How do I use this library to send commands to the console? All it does is print text...

Oh - I already mentioned this above...

Can I use this library to send commands? Or do I need to think of something else?

Re: LibCon - AutoHotkey Library For Console Support

Posted: 20 Feb 2019, 12:43
by joedf
What LibCon really does, is host a console window for your application. It wasn't meant for automating already run console windows per se. But it should be possible.
So if you dont require all the fancy console options, and just need input/output.
Maybe try something like MsgBox % ComObjCreate("WScript.Shell").Exec("cmd.exe /q /c dir").StdOut.ReadAll() (from old post by lexikos)

or maybe this function here (StdoutToVar):
https://autohotkey.com/board/topic/15455-stdouttovar/page-7#entry521368

Re: LibCon - AutoHotkey Library For Console Support

Posted: 20 Feb 2019, 12:48
by BGM
Thanks, Joe. Yeah, I have that, I was just hoping for something more streamlined. I was hoping for a good console library that would let me simply send commands, manage the window, and fetch text.

Re: LibCon - AutoHotkey Library For Console Support

Posted: 20 Feb 2019, 17:04
by joedf
Well you definitely could... Can show me an example of a command? are there any patterns for automation?