Jump to content

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

AutoHotkey on Linux!


  • Please log in to reply
25 replies to this topic
jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
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).

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
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.)

corrupt
  • Members
  • 2558 posts
  • Last active: Aug 05 2014 03:20 PM
  • Joined: 29 Dec 2004
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 :) ...

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
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.

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
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.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
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!

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
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).

daonlyfreez
  • Members
  • 995 posts
  • Last active: Jan 23 2013 08:16 AM
  • Joined: 16 Mar 2005
Maybe this could be the starting point of a *nix version of AutoHotkey (far, far in the future, probably...)?

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
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.

schlemihl1277
  • Members
  • 10 posts
  • Last active: Sep 28 2005 08:22 PM
  • Joined: 09 Jul 2005
Hi Community,

See also this thread according this theme:

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

Best regards.

schlemihl1277

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
@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.

schlemihl1277
  • Members
  • 10 posts
  • Last active: Sep 28 2005 08:22 PM
  • Joined: 09 Jul 2005
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

jonny
  • Members
  • 2951 posts
  • Last active: Feb 24 2008 04:22 AM
  • Joined: 13 Nov 2004
No, I don't. I've never had a use for such a function, so I've never looked. Sorry. :?

AHKnow*
  • Guests
  • Last active:
  • Joined: --
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.

Thalon
  • Members
  • 641 posts
  • Last active: Feb 25 2014 03:12 PM
  • Joined: 12 Jul 2005
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