LibCon - AutoHotkey Library For Console Support

Post your working scripts, libraries and tools
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

LibCon - AutoHotkey Library For Console Support

30 Sep 2013, 07:51

 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
Last edited by joedf on 19 Nov 2013, 00:54, edited 3 times in total.
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
Alibaba
Posts: 479
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: LibCon - AutoHotkey Library For Console Support

30 Sep 2013, 12:49

Wow, this looks awesome!
I never saw it in the old forum...
"Nothing is quieter than a loaded gun." - Heinrich Heine
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

30 Sep 2013, 19:57

Oh! Really! Oh well there you go! Hope you enjoy it as much as I do :D
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
Alibaba
Posts: 479
Joined: 29 Sep 2013, 16:15
Location: Germany

Re: LibCon - AutoHotkey Library For Console Support

01 Oct 2013, 11:38

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. :)
"Nothing is quieter than a loaded gun." - Heinrich Heine
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

01 Oct 2013, 17:20

im open to all suggestions ^__^
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
BGM
Posts: 464
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: LibCon - AutoHotkey Library For Console Support

05 Mar 2015, 21:12

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
User avatar
BGM
Posts: 464
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: LibCon - AutoHotkey Library For Console Support

05 Mar 2015, 21:25

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
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
GitHub: visionary1
Location: Seoul
Contact:

Re: LibCon - AutoHotkey Library For Console Support

06 Mar 2015, 01:00

niceeeeeee!!
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

06 Mar 2015, 02:04

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. :)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
BGM
Posts: 464
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: LibCon - AutoHotkey Library For Console Support

06 Mar 2015, 09:26

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.
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

06 Mar 2015, 17:15

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
;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
T_Lube
Posts: 67
Joined: 22 Oct 2014, 00:57

Re: LibCon - AutoHotkey Library For Console Support

03 Jul 2015, 02:58

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.
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

03 Jul 2015, 09:52

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 ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
Delta Pythagorean
Posts: 474
Joined: 13 Feb 2017, 13:44
GitHub: DelPyth
Location: Somewhere in the US

Re: LibCon - AutoHotkey Library For Console Support

01 Feb 2019, 15:44

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?
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

01 Feb 2019, 16:21

Possibly show some code? ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
BGM
Posts: 464
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: LibCon - AutoHotkey Library For Console Support

20 Feb 2019, 11:46

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?
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

20 Feb 2019, 12:43

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
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
User avatar
BGM
Posts: 464
Joined: 20 Nov 2013, 20:56
GitHub: bgmCoder
Contact:

Re: LibCon - AutoHotkey Library For Console Support

20 Feb 2019, 12:48

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.
User avatar
joedf
Posts: 7247
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: LibCon - AutoHotkey Library For Console Support

20 Feb 2019, 17:04

Well you definitely could... Can show me an example of a command? are there any patterns for automation?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500 @ 4.00 GHz, 2x8GB DDR4 3143 MHz, NVIDIA GTX 1060 6GB | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Google [Bot], shinemic, TheBestPessimist and 55 guests