Another ahk solution, coffeescript to ahk

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
Mimiko
Posts: 11
Joined: 09 Dec 2020, 10:37
Contact:

Another ahk solution, coffeescript to ahk

Post by Mimiko » 09 Dec 2020, 10:54

This is a little toy I recently wrote in my spare time at work that converts coffeescript (a javascript dialect, very similar to ruby) to ahk.
For me, this solution solves a lot of problems. Not only did it allow me to implement features with a more familiar syntax, but it also implemented some capabilities that v1 did not have, such as anonymous functions, template strings, function nesting, etc.

The following is the address of the project, which may not be very stable since it is a new project written on the fly.
https://github.com/phonowell/coffee-ahk

This is an example of what was actually written with the project, a game script for Genshin Impact.
https://github.com/phonowell/genshin-impact-script

Mimiko
Posts: 11
Joined: 09 Dec 2020, 10:37
Contact:

Re: Another ahk solution, coffeescript to ahk

Post by Mimiko » 16 Jan 2021, 04:11

This is an html for quick preview, drag and drop it into your browser and start playing immediately.
However, due to browser security policy restrictions, features like `include` and `import/export` are not available.
Attachments
coffee-AHK preview 0.0.31.zip
(647.44 KiB) Downloaded 137 times
Last edited by Mimiko on 23 Feb 2021, 01:27, edited 1 time in total.

guest3456
Posts: 3454
Joined: 09 Oct 2013, 10:31

Re: Another ahk solution, coffeescript to ahk

Post by guest3456 » 22 Jan 2021, 11:58

interesting


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

Re: Another ahk solution, coffeescript to ahk

Post by SOTE » 22 Jan 2021, 18:47

Yes, very interesting and thank you Mimiko for showing this. Also, reversing this transpiler and going from AHK to Coffeescript, appears quite intriguing as well.

Mimiko
Posts: 11
Joined: 09 Dec 2020, 10:37
Contact:

Re: Another ahk solution, coffeescript to ahk

Post by Mimiko » 22 Feb 2021, 05:35

https://github.com/phonowell/coffee-ahk/blob/master/doc.md
Simply write an instruction document.
I've been using this tool for practical development myself, and feel pretty good abt it.

Mimiko
Posts: 11
Joined: 09 Dec 2020, 10:37
Contact:

Re: Another ahk solution, coffeescript to ahk

Post by Mimiko » 27 Aug 2021, 04:17

So I came back with a little something new, a webapp based on Neutron.ahk
Since coffee-ahk is able to use javascript syntax to work with ahk, this project can be done all in javascript
Also, it would be nice if there was a webview2 library for 1.x :cry:
Attachments
Clock.zip
(516.19 KiB) Downloaded 84 times

User avatar
phil294
Posts: 7
Joined: 21 Jul 2022, 04:12
Contact:

Re: Another ahk solution, coffeescript to ahk

Post by phil294 » 08 Sep 2022, 04:50

so you can use CS to write AHK using libraries in CS that look like native JS but are actually AHK under the hood, and it all compiles with Ahk2Exe. And using Neutron you can mix your fake CS that compiles to AHK with *real* CS that compiles to JS and thus make it all single-language, if I've understood this correctly. This is all super fascinating. I've seen you even did Lodash and JQuery for AHK here: https://github.com/phonowell/shell/. Are the language and the libraries all full compatible with JS? In other words, can you execute Coffee-AHK in both your browser as JS and using your compiler as AHK?

CS and AHK are probably my favorite languages. I built CoffeeSense and AHK_X11 so I love to see both languages getting married :)

Mimiko
Posts: 11
Joined: 09 Dec 2020, 10:37
Contact:

Re: Another ahk solution, coffeescript to ahk

Post by Mimiko » 16 Oct 2022, 06:47

phil294 wrote:
08 Sep 2022, 04:50
so you can use CS to write AHK using libraries in CS that look like native JS but are actually AHK under the hood, and it all compiles with Ahk2Exe. And using Neutron you can mix your fake CS that compiles to AHK with *real* CS that compiles to JS and thus make it all single-language, if I've understood this correctly. This is all super fascinating. I've seen you even did Lodash and JQuery for AHK here: https://github.com/phonowell/shell/. Are the language and the libraries all full compatible with JS? In other words, can you execute Coffee-AHK in both your browser as JS and using your compiler as AHK?

CS and AHK are probably my favorite languages. I built CoffeeSense and AHK_X11 so I love to see both languages getting married :)
Methods injected into the js environment from ahk can be called in the browser via js with little perception of use. However, using js methods in ahk is much more difficult, as there are too many built-in functions missing.

Coffee-AHK can compile a copy of the code into both ahk and js, and both are basically the same at the syntax level, the only difference is the environment they run in.
So I can use CoffeeSense (yes, your awesome project) to compile the cs code into js first, use that js to call typescript for checking, and eventually provide static type support for ahk.
I've recently been writing d.ts for my past project to provide type support, and this feels very ...... modern. As of now, I've found no less than ten typo errors :p

Post Reply

Return to “General Discussion”