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
polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
The disassembly looks normal. Do you have an old version of Gtk# installed? Try changing the example code to:

MsgBox, 0, Title, Text, 100

autohotkey.com/net Site Manager

 

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


fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Well, I happen to have an old Gtk# version installed. I guess tomorrow I'll update.
Thanks :)

trik
  • Members
  • 1317 posts
  • Last active: Jun 11 2010 11:48 PM
  • Joined: 15 Jul 2007
Here is a fix for the feature infogulch requested.

public static int InStr(string Haystack, string Needle, string CaseSensitive, int StartingPos, int Count)
{
    StringComparison type = CaseSensitive == null ?
        StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
    int x = StartingPos;

    if (StartingPos < 0)
    {
        StartingPos = Math.Abs(StartingPos);
        while (--Count > 0)
            StartingPos = Haystack.LastIndexOf(Needle, StartingPos + 1, type);
    }
    else
        while (--Count > 0)
            StartingPos = Haystack.IndexOf(Needle, StartingPos + 1, type);

    return x < 1 ? -StartingPos : StartingPos;
}

It is based off of a function he and I were racing to create. Sadly, he won. I was not sure whether to return a negative or positive offset when a negative StartingPos was sent, but I went with negative.

The function in AutoHotkey:

_InStr(Haystack, Needle, CaseSensitive = False, StartingPos = 1, Count = 1) {
	If (StartingPos < 1) {
		DllCall("msvcrt.dll\_strrev", "Str", Haystack, "CDecl Str")
		DllCall("msvcrt.dll\_strrev", "Str", Needle, "CDecl Str")
		StartingPos := Abs(StartingPos)
	}
	
	While (--Count > 0)
		StartingPos := InStr(Haystack, Needle, CaseSensitive, StartingPos + 1)
		
	Return StartingPos
}

Religion is false. >_>

fincs
  • Moderators
  • 1662 posts
  • Last active:
  • Joined: 05 May 2007
Even though I updated Gtk# for .NET to 2.12.9-2, I still get an error message.
If I uninstall it I'm able to run the test script, but I need Gtk# for MonoDevelop.

AutoPepe
  • Members
  • 328 posts
  • Last active: Dec 10 2017 10:11 AM
  • Joined: 01 Jun 2007
I want to learn. I will stay here.

Best Regards

JohnnyTwoTone
  • Members
  • 45 posts
  • Last active: Mar 29 2011 02:51 AM
  • Joined: 10 May 2009
Should the COM library work yet?

I get this error when trying to compile. The .ahk is saved as UTF-8. I've tried with the original COM and the unicode one for Ahk_L.

<0>: ==> Could not look up method COM_Init


jethrow
  • Moderators
  • 2854 posts
  • Last active: May 17 2017 01:57 AM
  • Joined: 24 May 2009
The COM_L Library isn't designed to work with IronAHK. However, in the op Titan wrote:

Future changes will include ... Easier integration with other .NET assembles and COM

Also, I was wondering Titan, are you planning on extending object support to reflect javascript more? For instance:
ages[] := x ; extend array

; change so that the following works

ages[2] := x ; extend array
And I suppose I could study JSON more, but are you planning on implementing any sort of metafunctions - like AHKL?

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

Should the COM library work yet?

The COM_L Library isn't designed to work with IronAHK

Specifically the StdLib mechanism does not yet work because I haven't decided where the directories should be on Unix, ~/ahk, /usr/lib/ahk $AHKLIBPATH, or all three places? Until then you can try manually including the COM script or copying the code to your file. From what I remember it heavily relies on DllCall at memory addresses which is also currently unimplemented. I will make this a target for the next release however.

are you planning on extending object support to reflect javascript more?

Arrays can only be extended by one using [], an idea taken from PHP which does not work in JavaScript. Objects can be freely extended with any keys like ages["bob"] := x (equivalent to ages.bob := x). There are technical reasons for this which will be documented at some point but it is also to distinguish the functionality of the two types.

are you planning on implementing any sort of metafunctions - like AHKL?

I haven't used AHKL or studied its features but there are plans for extension methods.

autohotkey.com/net Site Manager

 

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


trueski
  • Members
  • 121 posts
  • Last active: Jun 25 2014 09:12 PM
  • Joined: 08 Apr 2008
Posted Image
-trueski-

TLM
  • Administrators
  • 3864 posts
  • Last active:
  • Joined: 21 Aug 2006
:lol: Nice one

Posted Image

don't duplicate, iterate!


Tuncay
  • Members
  • 1945 posts
  • Last active: Feb 08 2015 03:49 PM
  • Joined: 07 Nov 2006

haven't decided where the directories should be on Unix, ~/ahk, /usr/lib/ahk $AHKLIBPATH, or all three places?

I would appreciate if it is going to be configurable.
[*:2nwmvl6a]+ additional paths: $AHKADDPATH
[*:2nwmvl6a]o user library: /usr/lib
[*:2nwmvl6a]o standard library: %A_AhkPath%/lib in that order. The user can configure the envpath only.

The addpath is adding paths to the normal environment, for commands such Run etc. Also the library is searched in one of these pathes. Thats the idea (I do not really feel confident with this yet).

No signature.


AHKnow
  • Members
  • 121 posts
  • Last active: May 17 2009 09:11 PM
  • Joined: 03 Jul 2004
Oh my goodness. IronAHK is like some kind of wet dream. Fantastic!

DeWild1
  • Members
  • 369 posts
  • Last active: Feb 28 2014 08:15 PM
  • Joined: 30 Apr 2006
So this <!-- m -->http://www.autohotke...ic.php?p=241769<!-- m --> should be a thing of the past because it makes AHK 64 bit so the registry will get written to without complication or having to do this or that.. Right?

And with the bytecode compile, I should be able to digitally sign my apps without them getting corrupted... Right??

And now this <!-- m -->http://www.autohotke...pic.php?t=27146<!-- m --> was a sad waist of super Micha's time... Right???

Wow, the power of .NET in an easy to learn and understand AHK programming language, we all owe you our first born!

Now, before I upgrade all my clients to this, I will just need some way to make sure they have .NET 2.0 or higher.

I will compile and test and let you know if I find any problems.

DeWild1
  • Members
  • 369 posts
  • Last active: Feb 28 2014 08:15 PM
  • Joined: 30 Apr 2006
I found a script, written by someone esle, that does not work,
#SingleInstance force

#NoTrayIcon

#NoEnv

DateTimeStamp = %A_Year%%A_Mon%%A_DD%000000

HMS = 00:00:00.0

StringLeft, Day, A_DD, 1

If Day = 0

   StringRight, Day, A_DD, 1

Else Day := A_DD

Gui, Color, EEAA99

Gui, +Lastfound -Caption +AlwaysOnTop

WinSet, TransColor, EEAA99

Gui, Font, s10

Gui, Add, Button, w50 gUp, UP

Gui, Add, Button, w50 gDown x+30 ym, DOWN

Gui, Add, Text, x+10, %A_DDDD%`n%A_MMM%. %Day%

Gui, Font, w1000 s30

Gui, Add, Text, xm vtime, %HMS%

Gui, Font, s10

Gui, Add, Text, xm cBlue vAHK gAHK, AHK

Gui, Font, w400

Gui, Add, Button, x+15 vStop gStop, EXIT

Gui, Add, DDL, w22 x+5 vColor gColor

, Clear||Default|Aqua|Blue|Fuchsia|Gray|Green|Lime|Maroon|Navy|Olive|Purple|Red|Silver|Teal|White|Yellow

Gui, Add, Text, x+50, %A_YYYY%

Gui, Show, x60 y40, StopWatch

WinGetPos,,,w1

SetTimer, Focus

SetTimer, Blink, 500

return

GuiClose:

ExitApp

;

;#########

;#gLabels#

;#########

;

Up:

SetTimer, Count, 100

up = 1

TimerOn = 1

SetTimer, Blink, Off

GuiControl, Show, time

GuiControl,, Stop, STOP

return

Down:

SetTimer, Count, 100

up = 0

TimerOn = 1

SetTimer, Blink, Off

GuiControl, Show, time

GuiControl,, Stop, STOP

return

Color:

Gui, Submit, NoHide

If Color = Clear

{

   Color = EEAA99

   Gui, -Caption

}

Else Gui, +Caption

Gui, Color, %Color%

Loop

{

   Gui, Show, AutoSize

   WinGetPos,,,w2

   If (w2 >= w1)

      break

}

return

AHK:

Run, http://www.autohotkey.com/forum/viewtopic.php?t=13884

return

;

;#########

;##Timer##

;#########

;

Count:

If up

{

   tenth++

   If tenth > 9

   {

      DateTimeStamp += 1, seconds

      tenth = 0

      FormatTime, HMS, %DateTimeStamp%, HH:mm:ss

   }

}

Else

{

   tenth--

   If tenth < 0

   {

      DateTimeStamp += -1, seconds

      tenth = 9

      FormatTime, HMS, %DateTimeStamp%, HH:mm:ss

   }

   If (red != 1) AND (HMS = "00:00:00") AND (tenth = 0)

   {

      SoundBeep

      Gui, Font, Norm cRed w1000 s30

      GuiControl, Font, time

      red = 1

      up = 1

   }

}

GuiControl,, time, %HMS%.%tenth%

return

;

;#########

;##Stop###

;#########

;

Stop:

If timerOn

{

   SetTimer, Count, Off

   timerOn = 0

   If red = 1

   {

      Gui, Font, Norm cBlack w1000 s30

      GuiControl, Font, time

      red = 0

   }

}

Else

{

   GuiControlGet, ButtonName,, Stop

   If ButtonName = Exit

      ExitApp

   DateTimeStamp = %A_Year%%A_Mon%%A_MDay%000000

   HMS = 00:00:00.0

   tenth = 0

   GuiControl,, time, %HMS%

   GuiControl,, Stop, EXIT

   SetTimer, Blink, On

}

return

;

;#########

;##Blink##

;#########

;

Blink:

If toggle

 toggle = 0

Else toggle = 1

GuiControl, Hide%toggle%, time

return

;

;#########

;##DDL####

;#########

;

Focus:

GuiControlGet, focus, Focus

If (focus = "ComboBox1") AND (expand != 1)

{

   GuiControl, Move, Color, w70

   Control, ShowDropDown,, ComboBox1, StopWatch

   expand = 1

}

Else If (focus != "") AND (focus != "ComboBox1") AND (expand = 1)

{

   GuiControl, Move, Color, w22

   expand = 0

}

MouseGetPos,,,,focus

If (focus = "Static3") AND (Static3 != 1)

{

   Static3 = 1

   Gui, Font, Norm s10 w1000 c6495ED underline

   GuiControl, Font, AHK

}

Else If (focus != "Static3") AND (Static3 = 1)

{

   Static3 = 0

   Gui, Font, Norm s10 w1000 cBlue

   GuiControl, Font, AHK

}

return


DeWild1
  • Members
  • 369 posts
  • Last active: Feb 28 2014 08:15 PM
  • Joined: 30 Apr 2006
from CMD,

c:\ironAHK>IronAHK.exe decript.ahk
(0): ==> Object reference not set to an instance of an object.
decript.ahk (138): ==> Unclosed block
Could not execute: compilation failed

After some google time for "Object reference not set to an instance of an object. ", I tried the fix here, <!-- m -->http://www.smarterto...com/downloads/U ... acutil.zip<!-- m --> AND after getting C:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll from another PC and puting it on mine, I got this.

C:\>C:\WINDOWS\Microsoft.NET\Framework\v1.0.3
705\gacutil /i C:\Program Files\Microsoft.NET\Primary Interop Assemblies\adodb.dll
Falure initializing gacutil

I will PM you the code from decript.ahk because it's private.