AHKonsole - Class Based Console Library - Tetris!

Post your working scripts, libraries and tools for AHK v1.1 and older
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

AHKonsole - Class Based Console Library - Tetris!

23 Oct 2014, 21:21

I present https://github.com/G33kDude/Console

It's a wrapper for the win32 console. Currently pretty small, but still very flexible.

Examples:

A syntax highlighter proof of concept:
Image

A (working) IRC client:
Spoiler
Tetris clone!:
Spoiler
Last edited by geek on 17 Nov 2014, 09:53, edited 3 times in total.
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Win32 Console Wrapper Library

23 Oct 2014, 21:30

Very nice!
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Win32 Console Wrapper Library

30 Oct 2014, 14:36

Hey @Lexikos, Would it be possible to add a #directive that would make AHK not detach from the command line?

So that something like this won't look so odd, and that the attachconsole call won't be necessary

Code: Select all

DllCall("AttachConsole", "UInt", -1)
FileOpen("CONOUT$", "w").Write("Test")
MsgBox
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Win32 Console Wrapper Library

30 Oct 2014, 15:20

Well i'm not lexikos but, i can tell you that ahk is compiled as a GUI application.. What you probably want is the Console Subsystem. In the preview2 of ahk2exe there is a compile directive that can set the subsystem to console. I made a little ahk2exe wrapper that compiles ahk scripts to exe with the console subsystem.... I could probably make it a lot better.. But What you really want to look at here is this script by Lexikos that changes it for you: https://github.com/joedf/LibCon.ahk/blo ... hk2CLI.ahk
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Win32 Console Wrapper Library

31 Oct 2014, 10:42

That script turns a gui application into a console application? Neato! Any reason you're not in the IRC channel joedf?
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Win32 Console Wrapper Library

31 Oct 2014, 12:29

Sometimes I'm there but no so much recently.. :P
I'll try to pop on more often then ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Win32 Console Wrapper Library

01 Nov 2014, 18:22

I've gotten palette swapping to work! http://i.imgur.com/FH0DG5x.gif
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Win32 Console Wrapper Library

01 Nov 2014, 18:23

Bejeebus.... Dats Awesome. :D
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Win32 Console Wrapper Library

03 Nov 2014, 20:44

I've updated the palette in Syntax.ahk slightly, and fixed a bug in the hex detection (it didn't used to detect hex numbers with 0s in them).

Also, I added a new example script, Embed.ahk. It's a proof of concept for embedding a console as a control in your own gui. I wasn't sure how to fix a rendering issue until I saw @Ronin 's code that had a style which I did not (WS_CLIPCHILDREN). So, thanks Ronins! If you want, I can put you in the ReadMe
geek
Posts: 1052
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Win32 Console Wrapper Library - Tetris!

10 Nov 2014, 23:59

Added a new sample script, Tetris.ahk!

I added some methods for creating and manipulating console buffers, thus allowing me to double buffer my output. This means I can output (in color) the Tetris game screen seamlessly.

Image
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Win32 Console Wrapper Library - Tetris!

11 Nov 2014, 09:28

Shizzle! At this rate, I'll just deprecated Libcon.ahk ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
joedf
Posts: 8940
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: AHKonsole - Class Based Console Library - Tetris!

24 Nov 2014, 20:26

I gotz an Idea, Now as a class it will be much easier!
Console GUI! :D lol AHKonsole.GUI() :D
Image
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble, peter_ahk and 126 guests