Keysharp - the resurrection of IronAHK

Talk about things C#, some related to AutoHotkey
mfeemster
Posts: 16
Joined: 24 Apr 2020, 18:30

Keysharp - the resurrection of IronAHK

13 Jun 2020, 00:15

I am a senior developer myself with mostly Windows experience, a little bit of Linux, and no Mac OS experience.

From about 2010 to 2015, several people here worked on a project called Iron AutoHotKey which was a complete re-write of AHK in C# with the aim of being cross platform.

Sadly, the project was discontinued and the author is nowhere to be found.

The good news is that his source code is available in an archived repo on github.

I've downloaded it, upgraded the project files to Visual Studio 2019, reorganized and cleaned up a bunch of the code, started a new project based on it, and have it successfully building running on Windows and am able to debug it.

He did a ton of work which I am grateful for, I wouldn't have known where to begin had I started from scratch on my own.

With that baseline code, I can see where he implemented some basic code for doing things on Linux, but have not run that part yet, so I don't know if it will work. I am focusing on Windows for now.

I can also see a lot of empty parts that were left blank.

I am going to spend time inspecting and documenting just how much of the full AHK spec he implemented.

Once I get it all working on Windows, I will try Linux, then maybe Mac if I can get some assistance from Mac developers. IronAHK has already set up a good design for this. I will need to enlist help from volunteers for the latter two OSes.

I think now would be an ideal time to do it because Microsoft is really pushing hard to have C# be a dominant language for all major OSes.

Also, C# is an ideal language for implementing another scrpting language like AHK. C# supports runtime code generation which is very exciting. The AHK script code will get compiled into a new executable at runtime. That executable can also be saved and ran on its own for scripts which seldom change. It can also show the C# code that gets generated from the AHK code, for those who are interested in seeing it.

IronAHK used mono for its development work because mono has always been a cross platform version of .NET.

In recent times, Microsoft has made huge strides in being cross platform. Their .NET core, and .NET 5 release coming later this year, attempt to be cross platform. Sadly, in order to achieve that, they took a "lowest common denominator" approach and left out huge parts of the functionality of the regular .NET framework. IronAHK makes heavy use of those parts, such as the Keys enum, the Application object and various GUI components. The bad news is that since .NET core does not support these features, it can't be used for this project on non-Windows OSes. The good news is that mono implements these features. That provides the rather compelling scenario of writing GUI code in C# on linux.

For Windows, if one wants to use .NET (core) 5 but also have access to the standard libraries mentioned above, Microsoft supports making a hybrid sort of project. I'll be taking this approach for the windows release.

So to summarize:

Windows: .NET (core) 5 + Winforms

Linux/Mac: mono

During this development effort, I don't want to let the perfect be the enemy of the good. Just because some obscure feature might not work on one OS, doesn't mean we shouldn't work on the project at all. We will do our best.

I estimate the initial phase of the project will be a minimum of two years' worth of work. I'm three months into it so far.

The project will be hosted here:

https://bitbucket.org/mfeemster/keysharp/src/master/

Most of the discussion regarding bugs/features will be on the repo instead of this forum, because it offers better bug/feature traceability.

There is currently nothing at that repo other than a readme because I just wanted to reserve the catchy name ahead of time. I will wait until I have something working reasonably well before uploading my code.

Thanks,
Matt
burque505
Posts: 1330
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

02 Jul 2020, 14:52

:bravo: Really looking forward to it.
Regards,
burque505
mfeemster
Posts: 16
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

05 Jul 2020, 19:56

Still chugging along @burque505. I work on it almost daily. My process is such, starting with the most basic parts:

-Take a very simple, isolated part of the language as specified in the AHK help file, such as an assignment operator, multiply operator, creating and concatenating strings...

-Write a small script which uses that part of the language.

-Write a unit test which loads the script, compiles, and runs it and returns whether it passed or failed.

-Add this to my collection of unit tests.


So I am methodically going through and verifying what parts of the language IronAHK implemented, and which ones they did not. If I run into bugs (I've ran into many), I attempt to fix them, and then move on to the next part.

By keeping a large number of unit tests, I am able to ensure that any changes I make, don't lead to other bugs elsewhere. For every change, I run all unit tests.

So to give an idea of where I'm at. I've tested/improved all operators (= == := + - * / // | || & && and not or between >> << . etc...), some were broken.

I've fixed a lot of problems with hotstrings, and have optimized a few things. There are more optimizations I'll revisit later.

I've done some basic function testing.

Today I got associative arrays (dictionaries) working (IronAHK did not allow using variables as keys).

Arrays appear to work, but there is no support for the methods used on them, such as InsertAt() etc..., so that is my next target.

I also got sidetracked for a week trying to figure out which type of .NET I am going to use. I really, really want to use the latest, as I mentioned in my original post. But the .NET core used in .NET 5 does *not* support Winforms, which is crucial to IronAHK/Keysharp. You can't even do basic keyboard stuff (the entire point of this program) without Winforms. So after battling for a week, I realized you can make hybrid .NET core + Winforms projects very easily in Visual Studio 2019. Then of course, I tested a quick Mono project in Linux, and that worked ok. So I am happy about those decisions and am very relieved.

So that's where I'm at. Please sit tight, we have a long, long way to go. But rest assured I'm working on it almost daily.
Last edited by mfeemster on 05 Jul 2020, 22:16, edited 2 times in total.
User avatar
joedf
Posts: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Keysharp - the resurrection of IronAHK

05 Jul 2020, 21:20

Share your code? make it open to pull-requests?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]
mfeemster
Posts: 16
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

05 Jul 2020, 22:11

Hi Joe,

I am going to post it here:

https://bitbucket.org/mfeemster/keysharp/src/master/

Once I have it working reasonably well. Posting it before then won't do any good.

I'll announce here when I post it, which will be in another few months, but hopefully not more than six.

After that, we'll all collaborate there on fixing bugs and adding features.
joedf wrote:
05 Jul 2020, 21:20
Share your code? make it open to pull-requests?
User avatar
joedf
Posts: 7695
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada
Contact:

Re: Keysharp - the resurrection of IronAHK

06 Jul 2020, 09:26

I see, best wishes! :+1:
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x8GB G.Skill RipJaws V - DDR4 3280 MHz | [About Me] | [ASPDM - StdLib Distribution]
[Populate the AHK MiniCity!] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library] | [About the AHK Foundation]

Return to “C#”

Who is online

Users browsing this forum: No registered users and 2 guests