Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

IronAHK (alpha): cross platform .NET rewrite of AutoHotkey


  • Please log in to reply
581 replies to this topic
kuvisit
  • Guests
  • Last active:
  • Joined: --
Hi everyone,
I've been a Linux user for a looooooooong time and the only thing keeping me dependant from Windows is AHK. I found IronAHK today and I must ask you: is there a way to make my code work in IronAHK? I was looking it up, but without success.

w::Up
a::Left
s::Down
d::Right
q::F2 ;
1::F3 ;
2::F4 ;
3::F5 ;
e::F6 ;
r::F7 ; 
f::F8 ; 
v::F9 ;  
4::F10 ;
g::F11 ; 
b::F12 ; 
Space::Enter
LWin::F1 ;
z::+F1 ; 
x::+F2 ; 
c::+F3 ; 
^+z::Suspend


maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
I was wondering how IronAHK would compare with IronRuby or IronPython:[*:3tfdb69k]Would it also be able to run in a browser?
[*:3tfdb69k]Would it also be able to dynamically execute another "Iron"-Language (or being executed itself)?
[*:3tfdb69k]Would it also support access to .NET classes (Framework or just written in another .NET language)?
[*:3tfdb69k]What about the other way round (using IA code in e.g. C#, without dynamic execution)?And are there any news on IA since IsNull's last post?

Regards
maul.esel

Edit: I investigated a bit further and found some disadvantages:[*:3tfdb69k]IronPython / -Ruby run on the DLR (Dynamic Language Runtime). This seems to be developed / connected to MS, although I don't know how. So not sure if this is a disadvantage :)
[*:3tfdb69k]It seems you cannot use those from C# or VB.NET: you can create an engine and execute it dynamically, but you can't access any classes like e.g. C# classes. IA does not have classes, but it would be cool :)
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

IsNull
  • Moderators
  • 990 posts
  • Last active: May 15 2014 11:56 AM
  • Joined: 10 May 2007

I was wondering how IronAHK would compare with IronRuby or IronPython.

This is a good question and also the fact that IronRuby/IronPython integrate into the Visual Studio is very interesting. I will do some research on this on my next developing time for IA/AHK and my IDE plans. (I expect that will be in my winter holiday where I hopefully can take some time for this - I might then to do some tests on this platform as it seems to work good with other dynamic script languages.)

Btw: Having access to the .NET Objects is somewhat of a must have for a .NET implementation, as it is a must have for a (new) language to support objects (or another similar abstraction of the world).
Poly mentioned some time ago, that supporting objects in the current IA version is not that hard task. IMHO, those objects would be dynamic and therefore have a high performance penalty.

It seems you cannot use those from C# or VB.NET: you can create an engine and execute it dynamically, but you can't access any classes like e.g. C# classes.

You can use the whole .NET Framework, including full support for WPF. This is somwhat of the initial sense of those projects, isn't it? :)

Best
IsNull

maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
No, I meant: it seems you can't use IronRuby classes from C# (only dynamically).
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

Sinel1980
  • Members
  • 21 posts
  • Last active: Mar 13 2012 07:32 AM
  • Joined: 30 Aug 2010
After long fight installing all required libraries (mono, libx11-dev etc.) in Linux (Ubuntu) i finally have run IronAHK on my computer. But the result isn't good. It can show Message Box "Hi there" at start, but it can't hook any key (you can't assign any action to keys).

So, unfortunately, the result is worse then AHK (or AHK_L) on Wine 1.2.

So, I'm waiting for any new version of IronAHK.

joelpt
  • Members
  • 23 posts
  • Last active: Dec 09 2011 10:05 PM
  • Joined: 24 Jun 2009
Check out this presentation by Anders Hejlsberg about C# 5.0, or at least read the synopsis.

I'm not sure how much of this will be fully applicable to IronAHK; I imagine Mono will be hard-pressed to mimic C# 5.0/Roslyn in a reasonable timeframe. That being said, the way they are putting things together means we would most likely get the following "for free" for IronAHK under Windows:
* IronAHK syntax highlighting, refactoring, Intellisense in Visual Studio
* Interactive (stateful) IronAHK console under Visual Studio
* Automatic C# <-> IronAHK code transformation ("Paste as C#")
* Ability to call C# functions "natively" in IronAHK and vice versa, with IDE/Intellisense support
Looks very promising.

maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
One thing on DLR is that I'm not sure how and if that supports compilation at all.
[*:38a1veiw]After thinking about it some time, I understand that compiling any DLR-language to C#-like libraries is quite difficult / impossible, because of the dynamic features. And I also think it's not so important.
[*:38a1veiw]But compilation to a *.exe file is needed (for IA) IMHO.
But the original reason why I post is that a small hope is growing: IA is developed again! New commits reach the github repo! Please tell me if and how I can help :!: I know I can fork, but what to do next?

Regards
maul.esel
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

infogulch
  • Moderators
  • 717 posts
  • Last active: Jul 31 2014 08:27 PM
  • Joined: 27 Mar 2008
I think you mean CLR

After thinking about it some time, I understand that compiling any DLR-language to C#-like libraries is quite difficult / impossible, because of the dynamic features.

Hmm that makes me wonder. Intuitively, I'm guessing that the main problem is ahk's dynamic types. If that's the case I wonder if a .net type could be constructed that would emulate ahk's variable behavior in entirety, and if this would allow scripts to be compiled as libraries and be used by any .net language, not just IA scripts.

But compilation to a *.exe file is needed

This is the way IA works already.

All IA does is convert the ahk code to CLR bytecode which is executed by .net just like every other .net language including C#. Essentially one only needs to put IA's output into a file with an .exe extension, and I believe this is already possible.

Note, IA will always depend on the .NET Framework, and so will any executable it creates.

maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011
I know what IA is, and I know that it can currently compile to a *.exe.
Read the discussion on DLR we had before you post.

What I was talking about is, for example if IA supported classes one day, it may be difficult to use them from e.g. C#, because dynamic features such as adding new methods on runtime is difficult to emulate. The same is true for the other DLR languages (I think).
Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

IsNull
  • Moderators
  • 990 posts
  • Last active: May 15 2014 11:56 AM
  • Joined: 10 May 2007

Hmm that makes me wonder. Intuitively, I'm guessing that the main problem is ahk's dynamic types. If that's the case I wonder if a .net type could be constructed that would emulate ahk's variable behavior in entirety, and if this would allow scripts to be compiled as libraries and be used by any .net language, not just IA scripts.

Actually thats not the primary issue. You can use the Type "object" which can handle Objects and primitive types, and do all the casts by "hand", meaning that the IA compiler generates them.

What the IA compiler does is generating .NET Code Units, which can be compiled as exe or as library or it even can create C# Source-Code from it, so this is not a big problem at all. Much more interesting is how the generated code looks like, in terms of performance and in terms for reuse by another .NET Application/ other IA Script. This is the only problem which the current architecture of the IA generated code has: It is kind of a unreachable Blackbox.


@joelpt:
I personally think that this would be the way to go:
As IronPhyton can use the Visual Studio, so we can use it for AHK.

@maul.esel

What I was talking about is, for example if IA supported classes one day, it may be difficult to use them from e.g. C#, because dynamic features such as adding new methods on runtime is difficult to emulate. The same is true for the other DLR languages (I think).

One approach could be facading all the dynamic types with static object types. Additionally, C# 4.0 supports the type "dynamic" -> <!-- m -->http://msdn.microsof...y/dd264736.aspx<!-- m --> Which has more or less the prototype behaviour which Lexikos has implemented for AHK_L Objects.

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012

I understand that compiling any DLR-language to C#-like libraries is quite difficult / impossible, because of the dynamic features. And I also think it's not so important.

It has been a while since I last read the DLR specification but to the best of my recollection it still requires compilation (at some stage) to CIL. CIL is highly portable and works across all .NET languages, even with Java and native C. IronAHK compiles directly to CLS-Compilant CIL in a very direct and sophisticated fashion thanks to Tobias' thorough understanding of the core specification. However I agree with you, the DLR is not necessary and is beyond the scope of our development goals at this stage.

But compilation to a *.exe file is needed (for IA) IMHO.

Yes, compilation is a fundamental aspect of the project and my last two commits fixed some parts of a major bug in the compiler which Tobias and I had run into.

Intuitively, I'm guessing that the main problem is ahk's dynamic types. If that's the case I wonder if a .net type could be constructed that would emulate ahk's variable behavior in entirety, and if this would allow scripts to be compiled as libraries and be used by any .net language, not just IA scripts.

IronAHK supports this in full already. It does this by making extensive use of boxing and casting. While admittedly expensive, it is the most portable and flexible approach.

if IA supported classes one day, it may be difficult to use them from e.g. C#, because dynamic features such as adding new methods on runtime is difficult to emulate. The same is true for the other DLR languages (I think).

Adding new methods at runtime is not really difficult, it can be done by emitting opcodes or sometimes even by reflection. I've done similar things in Java many times with ASM and BCEL and the principals are the same.

This is the only problem which the current architecture of the IA generated code has: It is kind of a unreachable Blackbox.

This is true to an extent, but unavoidable due to features in AutoHotkey like dynamic variable names which is a concept that doesn't exist in any other language I know of. It is possible to bridge them over with public accessors, which is something planned for later.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


maul.esel
  • Members
  • 790 posts
  • Last active: Jan 05 2013 09:26 PM
  • Joined: 28 Feb 2011

Additionally, C# 4.0 supports the type "dynamic"

Interesting, I read on it but didn't use it at all so far.

However I agree with you, the DLR is not necessary and is beyond the scope of our development goals at this stage.

Damn, one more misunderstanding. I should better think about what I post.
Actually I meant DLR is more important than using compiled IA libraries from C# ;-)

Adding new methods at runtime is not really difficult, it can be done by emitting opcodes or sometimes even by reflection.

Good to hear. I didn't think of reflection.

Please tell me if and how I can help :!:


Join the discussion on The future of AutoHotkey
Posted Image Visit me on github Posted Image
Win7 HP SP1 64bit | AHK_L U 64bit

YetAnotherSuperhero
  • Members
  • 10 posts
  • Last active: Nov 29 2011 05:29 PM
  • Joined: 28 Feb 2011
I'm having trouble on Linux Mint 12

If I use a Send command and try to compile I get this:

Example.ahk (0): ==> Unable to change after type has been created.
Compilation failed.


If I run from the terminal ironahk Example.ahk I get:

^[[E^[[17~^[[18~^[[D^[[18~^[[D ^[[E^[OR^[[D^[[E

for "This is a test"

This is the last thing keeping me from using Linux, and it's beyond me...

Any help?

The Great Swami Woo
  • Guests
  • Last active:
  • Joined: --
AS there are already 3 versions that work on Windows would it not have been simpler to not try to make a cross platform version but just concentrate on making a version specifically for Linux?
It seems the idea was nice but turned out to be too difficult to do.

BGM
  • Members
  • 199 posts
  • Last active: Jun 05 2015 06:26 PM
  • Joined: 12 Jan 2011
Is this project still alive? Whilst looking for it, I find so many broken links. Is anyone using this? Where can I find documentation?