Jump to content


Photo

AutoHotkey on Linux!


  • Please log in to reply
25 replies to this topic

#1 jonny

jonny
  • Members
  • 2951 posts

Posted 23 March 2005 - 02:59 AM

So far I have only tested MsgBox, and I find it very encouraging that it works. I'm using Wine for this, btw. Below is an illustrated report of all I've done so far. To be kind to those on dialup, I haven't hotlinked the images.


Screenshot 1
Screenshot 2
Screenshot 3
Screenshot 4
Screenshot 5
Screenshot 6

The graphical install went smoothly, as I expected; nothing in standard Windows installs scare Wine, usually. [1..6]


Screenshot 7
Window Spy didn't work very well at all [7], so I'm having doubts about some of the window detection functions. We'll see later. It still reads the resolution and colors well, since they're probably basic API's that Wine has already implemented.


Screenshot 8
This is the result of the first AHK script ever run on a Linux machine (let's make a holiday :lol:). It shows a neat little message box [8]. For anyone who can't automatically convert a Gui to AHK code in their head:

msgbox,Hello, world!
return


Screenshot 9*
It also ran perfectly as a compiled executable; the result was identical [8]. The compiler didn't give Wine any trouble at all, and it actually gave me more output then I've ever seen in Windows! [9]


This is only the tip of the iceberg. I'll have a lot more to come later on. Specifically I'll be testing file manipulation and Gui's, both of which I am hopeful for. But the big one I'm still hesitant about.... hotkeys! :shock:

*Don't let the screenshot mislead you; Smith is not my surname. It's the hostname of my computer (named after the Matrix character).

#2 jonny

jonny
  • Members
  • 2951 posts

Posted 23 March 2005 - 03:46 AM

Screenshot 10
As I suspected, hotkeys do not work. Here is the script:

space::msgbox,Hello, world!

The output implies that it never receives the hotkey at all [10]. However, the script both shows up in the tray and runs the main window, so we can at least isolate the problems to the method used to receive hotkeys.


Screenshot 11
Here I've tried hotkeys once more, but this time with the use of the hook. Since Wine specifically states that it runs at the user level only and cannot do anything lower-level, I wasn't expecting much. AutoHotkey correctly relates that it was not successful in installing the keyboard hook, probably because Wine denied its API call [11]. The script used was identical to the one above, but with the #InstallKeybdHook and #UseHook directives.


I'll also note that the syntax checking works fine (yes, I deliberately tested it :lol:). From the above testing, I'll conclude that most of AutoHotkey's input methods will fail due to lack of lower-level access. I'll move on to Gui's now. (I might also add that without input methods, AutoHotkey falls somewhat short of AutoIt3. I'll eventually test that on Wine as well, but most of what it can do is already covered by existing scripting languages.)

#3 corrupt

corrupt
  • Members
  • 2558 posts

Posted 23 March 2005 - 03:49 AM

I haven't tested a script with hotkeys yet but any Gui scripts I have tested seem Ok so far on RH FC3 with Wine :) ...

#4 jonny

jonny
  • Members
  • 2951 posts

Posted 23 March 2005 - 03:58 AM

Oh yes, I forgot to mention that I'm running Gentoo. Also, I just realized something which should've been obvious from the start... AutoHotkey will always be confined to the virtual C: drive Wine runs it in! This obviously degrades its usefulness for almost anything other than Gui's. I'm currently testing the clipboard, and then I'll try gui's.

#5 jonny

jonny
  • Members
  • 2951 posts

Posted 23 March 2005 - 05:06 AM

Screenshot 12
I was pleasantly surprised to find the clipboard in good order [12]. The msgbox shows the clipboard, which is also the script itself. I'm still thinking of a good way to test clipboardall.

Writing to the clipboard was a different story; the first time it's accessed, it leaves the previous contents untouched, and the second time it simply wipes it (regardless of what the intended assignment was). This behavior is consistent and reproducible.

That's all the more I'm going to do tonight; tomorrow night I'll have a much longer post, and hopefully more detailed.

#6 Chris

Chris
  • Administrators
  • 10727 posts

Posted 23 March 2005 - 09:43 PM

I'm a little surprised hotkeys don't work. Perhaps you could try a more typical hotkey such as these two:
#p::
^!p::
MsgBox You pressed %A_ThisHotkey%.
return
I'm not sure what could be causing the clipboard misbehavior.

Thanks for posting such elaborate findings!

#7 jonny

jonny
  • Members
  • 2951 posts

Posted 23 March 2005 - 10:01 PM

Sorry, that doesn't work either. I might also note that alwost every Window Manager in Linux has their own hotkey handlers (often more than one), and these might interfere with it. I'm sure the method you use is pretty basic, but it would probably still require a little effort to truly port it (if any such effort were made in the future). Also, like I hypothesized, it might just be Wine denying the API needed. If it were ported to X, it might run as is (but that mould probably be harder than it sounds).

#8 daonlyfreez

daonlyfreez
  • Members
  • 995 posts

Posted 28 March 2005 - 06:52 PM

Maybe this could be the starting point of a *nix version of AutoHotkey (far, far in the future, probably...)?

#9 jonny

jonny
  • Members
  • 2951 posts

Posted 29 March 2005 - 03:16 AM

If anyone's been wondering where I was, I was up at Lake Superior skiing. But hey, I'm back! Anyway, about Claro; I don't think it's entirely realistic at this point to rewrite AutoHotkey with new libraries just so it could work on Linux, but it's definitely something to look forward to.

#10 schlemihl1277

schlemihl1277
  • Members
  • 10 posts

Posted 28 September 2005 - 04:44 PM

Hi Community,

See also this thread according this theme:

http://www.autohotke...opic.php?t=4402

Best regards.

schlemihl1277

#11 jonny

jonny
  • Members
  • 2951 posts

Posted 01 October 2005 - 02:15 AM

@schlemihl1277: Thank you for your contributions. Over the summer, I've become much more fluent in Linux and realized that such tools are redundant if you have a good window manager and xmodmap, but I can see that some of the tools you've suggested could prove useful in their own right.

#12 schlemihl1277

schlemihl1277
  • Members
  • 10 posts

Posted 02 October 2005 - 08:44 PM

Hi Jonny,

Fine that you can handle your scripting tasks under linux. But have you an idea how to manage an equivalent for the AHK-function "ImageSearch" in Linux?

Best regards.

schlemihl1277

#13 jonny

jonny
  • Members
  • 2951 posts

Posted 03 October 2005 - 01:40 AM

No, I don't. I've never had a use for such a function, so I've never looked. Sorry. :?

#14 AHKnow*

AHKnow*
  • Guests

Posted 05 October 2005 - 01:20 AM

Why not continue to see how much AutoHotkey can do in Linux? It seems AutoHotkey already has some basic funtionality and could have more with some.

I guess a big advantage is that scripts made in Windows, could often run on Linux too. If somebody made a utility, game, etc... on Windows than their Linux pals could use them too. This ability just opens up the market and user base for AutoHotkey.

If you used another Linux program than you would not be able to run the same scripts on both Windows and Linux, and not by using AutoHotkey.

#15 Thalon

Thalon
  • Members
  • 641 posts

Posted 21 December 2005 - 12:46 PM

Is there any actual info? The screenshots do not work any more... :(
I was asked if a tool of mine could be run also on Linux. It doesn't use any Hotkeys.
It uses many GUI-Features (also Listview), all other is String-handling and reading/writing from/to files...

Should this be possible with such an emulator?

Thalon