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
-deXter-
  • Members
  • 45 posts
  • Last active: Dec 23 2013 11:26 PM
  • Joined: 28 Nov 2004

Yes, this is the most impressive fork of ahk. I will definitely use it. Ahk was one of the most reasons not to changing to Linux. I was playing with the thought to forget about ahk because i will use in near future Linux mainly in a dayly basis.
IronAHK is greater than great. All i have dreamed would become true.


+1

And I thought I was the only one with that excuse! :) However, I couldn't stand MS' tactics anymore so I got fed up, deleted my C: and permanently switched over to Linux. I've already started looking at Python and TCL as possible replacements, but from what I've seen so far, they're certainly no AHK. Python etc are certainly powerful yes, but I definitely see a need for something not as powerful but a hundred times simpler to use.

wooly_sammoth
  • Members
  • 644 posts
  • Last active: Jul 03 2013 08:08 PM
  • Joined: 12 May 2009
I agree totally. I can't wait to be able to install a Sparrow web server on my Linux box.
I'm never going to get any proper work done ever again!

TLM
  • Administrators
  • 3864 posts
  • Last active:
  • Joined: 21 Aug 2006
Has this been tested on OSX yet? Whats the status plz.

Thanks

Posted Image

don't duplicate, iterate!


polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
I don't have OSX so I haven't been able to test although most things should work just as they would on Linux. Currently the status page only shows progress on Windows but I plan to list details for the other operating systems there too.

To run IronAHK on OSX you will need to install Mono. The only other requirement is X11, it is likely you have this already. Download and extract the zip then run in terminal: mono IronAHK.exe Example.ahk. I will create an .app version later on so scripts can be launched from Finder without using command line.

Thanks to everyone for showing their support :)

autohotkey.com/net Site Manager

 

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


TLM
  • Administrators
  • 3864 posts
  • Last active:
  • Joined: 21 Aug 2006
Amazing! Thanks again Titan :D

Posted Image

don't duplicate, iterate!


polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
Since this week was an extremely busy one for me I could not complete the targets for v0.7. So instead I have updated another minor version, v0.5.7 with some new features highlighted below.

v := { a : "xyz", d : "gone", b : [5, 4, 3, 2], c : "!" } ; create an object
v.b[1] -= 6 ; make the second array element -2
[color=deeppink]v.d := null[/color] ; deletes the element

[color=deeppink]Loop, Each[/color], %v% ; iterate array and object elements with an each-loop
{
	If ([color=deeppink]A_LoopField is "array"[/color] and A_LoopField[0] > 0) ; "is" has become an expression operator
	{
		Loop, Each, %A_LoopField%
		{
			n := A_Index - 1 ; since arrays are zero-based
			MsgBox, Element %n% is %A_LoopField%

			if A_loopfield < 0
				[color=deeppink]break 2[/color] ; break outside the second parent loop, continue works this way too
		}
	}
	
	MsgBox, [color=deeppink]%A_LoopKey%[/color] is %A_LoopField% ; new variable for key name
}

Setting a variable or object element to null will delete it, although this does not guarantee memory will be freed immediately.

The each-loop iterates over array and object elements. For objects, the new variable A_LoopKey is set to the key name of the current element. Since strings in .NET can be accessed as char arrays the following would also work:

var =abcdef
Loop, Each, %var%
	MsgBox, Letter %A_Index% is: %A_LoopField% ; shows each letter one by one

is has been promoted to a real operator that can be used in expressions. It has the same precedence order as the other equality operators (< > <= >=). The right hand side can be any one of the standard types, object or array.

break and continue now have a parameter to indicate which parent loop block should be used. This number cannot be dynamic.

The following controls are not yet implemented: UpDown, DropDownList, ComboBox, ListBox, ListView, TreeView, Hotkey, DateTime, MonthCal, Slider, Tab and WebBrowser. The other nine controls and windows can be used but are not fully functional in this release i.e. g-labels, events or GuiControl/Get do not work. This will be completed for v0.7.

Finally an OS X bundle can now be downloaded for Mac users who prefer the standard way of installing apps.

autohotkey.com/net Site Manager

 

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


samlimster
  • Members
  • 20 posts
  • Last active: Feb 18 2011 12:47 AM
  • Joined: 04 Dec 2009
Hi folks.

WOW! I'm still recovering from the shock! I just moved to Mac and it looks like my Fav scripting tool is moving with me! :)

Unfortunately, I can't seem to get things working. I just downloaded the installer IronAHK.app-0.5.7.zip IronAHK 0.5.7 (alpha) OS X
from the ironAHK site, unzipped it and ran it, but it doesn't seem to be doing anything.

I tried writing a simple msgbox script but can't figure out how to execute it.

I'm using snow leopard... not sure if that's a problem.

Please excuse my ignorance as I'm still very new to this. Any help would be GREATLY appreciated!

Thank you!

Sam.

samlimster
  • Members
  • 20 posts
  • Last active: Feb 18 2011 12:47 AM
  • Joined: 04 Dec 2009
I managed to get it running using your original mono method. I still haven't figured out how to get the IronAHK.app running.

I tried my first script and it kind of works:


msgbox, Hello World

A::
msgbox, I just pressed A
return


In the script above the first message box works fine, but when I type "a" nothing happens. Am I missing something?

Thanks again!

Sam.

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
My CPU doesn't support hardware virtualisation so I'm unable to install OS X and test it. From what I've read it seems like you can just extract the .app from the .zip and open it as if it were an .exe on Windows. Doing so should give you a message box like:

---------------------------
IronAHK
---------------------------
To get started, would you like to view the help documentation?
---------------------------
Yes No
---------------------------


You could also try having #!~Desktop/IronAHK.app (or where ever you extracted it) as the first line of your script then opening the script file directly.

X11 hotkeys are only working in the development branch so you won't see them until v0.7 due next Sunday unfortunately.

autohotkey.com/net Site Manager

 

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


samlimster
  • Members
  • 20 posts
  • Last active: Feb 18 2011 12:47 AM
  • Joined: 04 Dec 2009
Thanks for the info, Titan.

I just tested the .app file as you said and noticed that nothing happens. The script icon opens up in the doc momentarily and then disappears.

The old method, appears to work better though. Looking forward to any updates.

sam.

XYZ
  • Members
  • 224 posts
  • Last active: Apr 29 2010 01:48 PM
  • Joined: 20 Mar 2010
did you completeylt rewrite ahk?? :shock: :shock: :shock:

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

autohotkey.com/net Site Manager

 

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


HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Hi Titan, I have played a little with objects and noticed that digits are not supported, is this a bug?
a:= { }

a["1"]:=1

MsgBox % a["1"] ;works



a:= { }

a[1]:=1

MsgBox % a[1] ;does not



a:= { }

b:="1"

a[b]:=1

MsgBox % a[b] ;works



a:= { }

b:=1

a[b]:=1

MsgBox % a[b] ;does not



a:= { }

1:="1"

a[1]:=1

MsgBox % a[1] ;does not


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

I have played a little with objects and noticed that digits are not supported

Yes that is by design. Associative arrays (or objects) are strongly typed dictionaries with string key and object (i.e. any type) value pairs. Using a numeric value implies an index and not a key reference, which is only allowed for basic arrays. The following table illustrates the difference:

Posted Image

IA follows JavaScript syntax in this respect with the exception of appending arrays which comes from PHP.

In the CLR every data object has type information, in your second code example the IA compiler sees 1 as a literal integer and pushes an int32 on the evaluation stack for indexing a, which according to the table is not possible so null is returned. You can avoid this by using the common empty string concat. trick to force that sub-expression to cast as a string:

a:= { }
a[1[color=darkred] . ""[/color]]:=1
MsgBox % a[1[color=darkred] ""[/color]]

This is also true for the fourth example, b stores a boxed int32 value.

Your last example uses legacy syntax which is deprecated and will cause compiler errors in v2 of IA. Using integers as variable names has little effect as they are not recognised in expressions, so the last case is the same as the second one I just talked about. This is like AutoHotkey:

1 := "x"
MsgBox, % 1

autohotkey.com/net Site Manager

 

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


HotKeyIt
  • Moderators
  • 7439 posts
  • Last active: Jun 22 2016 09:14 PM
  • Joined: 18 Jun 2008
Thanks for clarification Titan.
Since a[1] is not valid, could it be automatically converted to a["1"].
The same for any expression like a[1+1].
This would save a lot of time, errors and code amount since no "" and no concat is required :?: