Keysharp - the resurrection of IronAHK

Talk about things KeySharp, some related to AutoHotkey or C#
burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

Post by burque505 » 23 Feb 2023, 15:27

@robodesign, yes. DotNET uses System.Threading.Thread to accomplish this.
Here's a pic of dnSpy capturing it in Keysharp.Core.dll:
threading.PNG
threading.PNG (14.92 KiB) Viewed 5307 times
Regards,
burque505

User avatar
mfeemster
Posts: 104
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

Post by mfeemster » 23 Feb 2023, 15:50

robodesign wrote:
23 Feb 2023, 14:13
@burque505 . I will keep that in mind. Thank you . Do you know if it will have multi-threading support as ahk_h ? Most of my projects rely on that.

@boiler . Thank you for the tip.

Best regards, Marius.
This is still up in the air as to exactly how we will accomplish this. I have never looked at the ahk_h code, but it's definitely something I want to do. If it seems like their threading work can be ported to .NET threads/tasks, then I will attempt to do that at some point.

Still trying to get the basics done first so people can begin testing.

User avatar
mfeemster
Posts: 104
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

Post by mfeemster » 26 Mar 2023, 14:31

I am happy to report that I have finally finished hotkeys, including the AltTab kind.
In addition, I've improved code and fixed bugs relating to classes, #directives and several other areas of code.

I have NOT implemented a proper threading model yet. So the Thread() function is not implemented, and launching multiple hotkeys/strings on top of each other will not work like you expect.
I have also NOT implemented COM. I would like to get input as to whether people want me to implement COM first before beginning opening up testing to a wider audience, or wait until after/during testing to get going on it.

We need to have a chat about how exactly we want threads to be done. I've examined ahk_H for ideas, but it doesn't really seem like they handle threads in a way that would work well with Keysharp.

So minus threads and COM, I think I have now fully implemented a C# version of AHK, minus the ~200 differences that I've documented.

With this great news, we are to the point where I will need the people here to begin helping with testing.


I want to do a voice/video call on Discord to discuss how exactly we'll go about this and solicit peoples' input on what they think the best path forward is.

Everyone on this thread who wants to contribute ideas, code, testing etc... please chime in.

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

Re: Keysharp - the resurrection of IronAHK

Post by joedf » 26 Mar 2023, 18:44

Very cool! Congrats! :bravo: :clap: :dance:
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]

robodesign
Posts: 934
Joined: 30 Sep 2017, 03:59
Location: Romania
Contact:

Re: Keysharp - the resurrection of IronAHK

Post by robodesign » 27 Mar 2023, 10:15

Where can I find a build to test it?

Ahk_H type of threading is super important for me.....

You mentioned 200 differences. Documented where? I'd like to see the list.

Congratulations on the progresses you made.

Best regards, Marius.
-------------------------
KeyPress OSD v4: GitHub or forum. (presentation video)
Quick Picto Viewer: GitHub or forum.
AHK GDI+ expanded / compilation library (on GitHub)
My home page.

User avatar
mfeemster
Posts: 104
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

Post by mfeemster » 27 Mar 2023, 11:54

The project repo is here: https://bitbucket.org/mfeemster/keysharp/src/master/

Build it with Visual Studio 2022.

It works in a fundamentally different way than what you are used to in AHK. So I'd like to get on a voice call with everyone in Discord sometime soon to go over it.

I'll publish the differences list soon.

bloom11
Posts: 3
Joined: 12 Oct 2022, 14:06

Re: Keysharp - the resurrection of IronAHK

Post by bloom11 » 08 Apr 2023, 12:00

hi, personally I didn't find the link to the discord server,. I probably missed it, but could someone add it to the thread or explain how to find it, thank you, bye

Michaohneel
Posts: 7
Joined: 07 Feb 2021, 16:37
Contact:

Re: Keysharp - the resurrection of IronAHK

Post by Michaohneel » 08 Apr 2023, 12:03

bloom11 wrote:
08 Apr 2023, 12:00
hi, personally I didn't find the link to the discord server,. I probably missed it, but could someone add it to the thread or explain how to find it, thank you, bye
https://autohotkey.com/discord
Come talk to me over on the Discord server :)

ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: Keysharp - the resurrection of IronAHK

Post by ahk7 » 16 Apr 2023, 04:29

I don't know what the current status is but if you want feedback you might want to make it a bit easier for some to dip their to in and prepare some write ups and documentation. (I for one won't join any Discord or live chat/stream to read some info for example, that is just the way it is)

Some suggestions:

1. Do offer a compiled version for download, OR do a bullet point write up of how to compile it e.g. download Visual Studio 2022 here, install it, perhaps any settings??; download source code here; open file X in Visual Studio, now use Compile etc. (This can be tedious no doubt but I have no clue about Visual Studio or compiling anything)

2. Provide some very basic example scripts - or explain where to find them e.g. MsgBox Hello, ::btw::by the way etc

3. Links to files in your repository that list some important changes or a "TO DO" list

Just my 2cts

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

Post by burque505 » 16 Apr 2023, 08:08

@ahk7, maybe I can help in some small way with that.

Things you'll need:
A) git, either CLI or GUI version
B) Visual Studio 2022 (community version is what I use).

BUILDING AND INSTALLING


1) Clone the repo here. The cloning process is not radically different from cloning a github repo, but do note that if you're using the git CLI that clicking the clone button will put "git clone https://bitbucket.org/mfeemster/keysharp.git" in the keyboard, not just the repo URL as with github.
2) In the 'keysharp' folder, you should see 'keysharp.sln'. Right-click and open with VS 2022 (or whatever way you prefer, but do open it in VS 2022. You'll need the .NET 7.0 that installs with it. Keysharp depends on it).
3) Make sure the project is set as shown.
4) Build the solution (only takes a few seconds, even on my 8-year-old machine). Note that 'Keysharp.Install' does NOT get built at this point.
5) Once the solution has compiled successfully, right-click on the 'Keysharp.Install' folder and build it. In the 'Keysharp.Install\Release' folder you will see 'setup.exe' and 'Keysharp.msi'. I generally move those out of the Release folder to another location on my system.
6) Your mileage may very, but for now, at least with my own setup, I have to run 'setup.exe' as admin.
7) In a few seconds Keysharp will install. If choose to add Keysharp to the path from the setup dialogs, it will append the path to your existing path. (If you uninstall - in typical Windows fashion - the Keysharp entry will be removed from your path without altering any of your other entries.)

FIRST STEPS WITH KEYSHARP


1) In the folder 'Keysharp.Tests' you'll find quite a collection of test scripts and sample scripts. I would suggest running the very-much-a-work-in-progress 'keysharp\Keysharp.Tests\Code\Gui\guitest.ks'. Run it from that folder, or copy the whole folder to another location. It relies on the other files in that folder.
2) In the folder 'Keysharp.Tests\Examples' are some examples (still with the .ahk extension). You can run them with Keysharp by issuing 'keysharp.exe [filename].ahk', or you can change the file extension to .ks and (provided you've chosen to add Keysharp to the path) and run them by double-clicking.
3) Compiling with Keysharp is really easy. If you have a file, e.g. 'testme.ks', issuing 'Keysharp.exe -exeout testme.ks' will create an executable 'testme.exe', and a 'testme.dll' (due to the way .NET now creates executables). You will probably get a Keysharp.Core.dll as well, also a 'testme.runtimeconfig.json'. You should be able to move these files (together that is) anywhere, and the exe should run.

By all means, please let me know if any of these steps are incorrect or incompletely described.
Regards,
burque505

ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: Keysharp - the resurrection of IronAHK

Post by ahk7 » 16 Apr 2023, 08:28

Thanks, but I think you may need to dumb it down a bit more, I get the screen below and now what? I can imagine I don't need python or node but I see three "net" somethings in the image alone.
Untitled.png
Untitled.png (38.01 KiB) Viewed 4646 times

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

Post by burque505 » 16 Apr 2023, 08:34

Install, at a minimum, .NET desktop development.
desktop_dev.PNG
desktop_dev.PNG (7.34 KiB) Viewed 4644 times
Let me know when you get stuck after that. It's been awhile since I installed it - don't remember whether I had to select an option to be able to open .sln files from the context menu, but if you get that choice I would take it.

ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: Keysharp - the resurrection of IronAHK

Post by ahk7 » 16 Apr 2023, 10:30

It does something - but doesn't work - I've installed the community edition etc, built it, but the keysharp.install is incompatible. A window pops up with the info below, the "Keysharp.Install.vdproj" has no meaningful info (to me). This is not something I'm too interested in getting to work, so I'll wait until there are some actual beta versions available at some point before testing it out. Thanks for the help though :thumbup:
Unsupported
This version of Visual Studio is unable to open the following projects. The project types may not be installed or this version of Visual Studio may not support them.
For more information on enabling these project types or otherwise migrating your assets, please see the details in the "Migration Report" displayed after clicking OK.
- Keysharp.Install, "C:\Keysharp\keysharp\Keysharp.Install\Keysharp.Install.vdproj"

Non-functional changes required
Visual Studio will automatically make non-functional changes to the following projects in order to enable them to open in Visual Studio 2015, Visual Studio 2013, Visual Studio 2012, and Visual Studio 2010 SP1. Project behavior will not be impacted.
- Keysharp, "C:\Keysharp\keysharp\Keysharp.sln"

User avatar
mfeemster
Posts: 104
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

Post by mfeemster » 16 Apr 2023, 13:01

Great writeup @burque505 , thanks.

I'm hesitant to have people build it themselves because it just adds more complexity.

Building the installer is not necessary to run it from the command line. However if you want to @ahk7 , you need to:

Click Extensions -> Manage Extensions.
Click Online, and search for "Microsoft Visual Studio Installer Projects 2022", and click Download.
This will require a restart of Visual Studio to install it.
Once you've restarted and opened the solution again, right click on Keysharp.Install and click "Reload Project".
Right click the project and click Build.
The output will be located at: keysharp\Keysharp.Install\Release\Keysharp.msi

We're still working through a few last minute pieces.

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

Post by burque505 » 16 Apr 2023, 13:18

@mfeemster, thanks, I had completely forgotten about having to install the Microsoft Visual Studio Installer Projects 2022. Sorry, @ahk7!

ahk7
Posts: 574
Joined: 06 Nov 2013, 16:35

Re: Keysharp - the resurrection of IronAHK

Post by ahk7 » 16 Apr 2023, 16:45

Ah OK, so no need to compile the installer to get the program, I just searched for "Keysharp.exe" and found it in "keysharp\bin\debug\net7.0-windows" - when I copied "MsgBoxButtonNames.ahk" to it and ran Keysharp.exe MsgBoxButtonNames.ahk it worked :dance:

So step 1 to 4 are enough to get going

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

Post by burque505 » 16 Apr 2023, 17:28

Nice work, @ahk7, good job!
Regards,
burque505

User avatar
mfeemster
Posts: 104
Joined: 24 Apr 2020, 18:30

Re: Keysharp - the resurrection of IronAHK

Post by mfeemster » 04 May 2023, 03:00

It is with great pleasure that I announce an initial release of Keysharp.

I began this long journey during the start of the lockdowns in 2020 and have worked almost non stop on it for three years. So this is a momentous occasion.

Over the past year, @burque505 has helped substantially with testing and feedback. A big thanks goes to him.

You can find a lengthy writeup of how to run it and what to expect here: https://bitbucket.org/mfeemster/keysharp/src/master/

A Windows installer and portable zip file can be found here: https://bitbucket.org/mfeemster/keysharp/downloads/

We are calling this version 0.0.0.1, signifying that it is going to be very primitive, unpolished, buggy, unreliable and rough around the edges. Despite mine and @burque505 's best efforts, heavy unit testing, and fixing well over 100 bugs, we are sure you will help us find many, many more.

Before you start coding, be mindful of the list of differences between Keysharp and AHK listed above.

I recommend starting off your testing with very small scripts to ensure the basic functionality works as you'd expect, then build up from there.

I also recommend writing your code in the Keyview.exe program which is contained in the installer and zip file. This will allow you to see in real-time whether your script code can be properly compiled without syntax errors. It's a very primitive editor, and I hope to get help from you in the future to make it better.

For quick questions, post them here or ask in the Discord. For serious bug reports, please make an account on bitbucket.org and post under the Issues page so we can track progress on fixing them.

I'm headed out of town for a few days, hopefully there will be a lot of feedback next week when I return.

:D

burque505
Posts: 1731
Joined: 22 Jan 2017, 19:37

Re: Keysharp - the resurrection of IronAHK

Post by burque505 » 04 May 2023, 08:20

I'd like to thank @mfeemster very much for all his work on this project.
Please feel free to post here with questions and to report issues. To the extent I can I'll respond while @mfeemster is not available.

I've uninstalled and reinstalled Keysharp many, many times in the last few months, following each commit. I have not had a single issue with path corruption. Uninstalling removes Keysharp from the path, but leaves all other entries intact. I suggest adding Keysharp.exe to your path (the option is probably already checked in the installer) if you plan to do a bit of experimenting. Of course you can do that manually even if you're just running the portable version.
Do read the 'readme.md' at the github repo.

The file 'guitest.ks' at this folder in the Bitbucket repo , although still very much a work in progress, makes use of nearly all the controls and GUI functionality of Keysharp. Running and examining that code will give you a good head start on working with Keysharp. Please download al the files in that folder to ensure the GUI works properly. N.B.: A few last-minut tests toward the end have not made it into the version of guitest.ks at the Bitbucket repo, but they are in any event minor and will make their way into the code soon.

There are a few examples of working scripts at this url also. You'll notice that nearly all the tests in this folder and in the root of this folder have files with .ahk extensions. To run them from the command line, of course your system will have to be able to find Keysharp.exe. If you dare to use the installer (or use the portable version and modify the path) you can simply run e.g. 'C:\YourFolder\keysharp\assign-dyn-var.ahk'. Rename it with a '.ks' extension and you can run 'C:\YourFolder\keysharp\assign-dyn-var.ks'.

Regards,
burque505

SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Keysharp - the resurrection of IronAHK

Post by SOTE » 22 May 2023, 02:36

It is fantastic that Keysharp has reached this point. :dance: :bravo:

Wondering if this project should be mirrored on SourceForge (https://sourceforge.net/) or on GitHub too. This exposes Keysharp to more random or newbie users, who knew nothing about automation or the rich history. An argument could be made about how things show up in Google and Bing, so some other places might be good. If not now, maybe something to think about for the future.

Also, perhaps it's time for Keysharp to have its own subforum, like AutoHotkey_H does. This is more or just as much related to AHK, than it is to discussing C# in general.

Post Reply

Return to “KeySharp”