LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-23-2014, 08:11 PM   #1
kktsuri
LQ Newbie
 
Registered: Jan 2014
Distribution: Mint
Posts: 22

Rep: Reputation: Disabled
AutoHotkey on Linux?


Hello guys,

Forgive me if this is in the wrong section, I thought "software" would fit it but if it is purely for Linux software, do move it where appropriate.

Before I begin let me say first for those who do not know: AutoHotkey is an open source macro-creation and automation software for Windows, with great scripting capabilities. (link: http://www.autohotkey.com/)

I have another question regarding Linux/Wine combo here (because I've been searching in vain and no port of AutoHotkey to Linux...). Firstly, I have absolutely no issue with WINE, it's the main reason I even switched to Linux because I have some proprietary apps and some others I'm too used to let go of.

Now, with that said, I use AutoHotkey with certain apps. A lot. In fact, I've written so many AHK scripts for some applications that it would take me several days to just skim through all the code (assuming I read about 4 hours at a time).

So, while alternatives to AutoHotkey are nice and all, I need something that can actually read the ahk scripts... and I tried WINE already obviously, but it seems to malfunction somewhere with AutoHotkey.


Basically, I use AutoHotkey mainly for this kind of stuff: Have some Hotkeys, make them do specific actions mostly involving pressing buttons or clicking with the mouse and scrolling. That's about it, but it seems WINE can't do that properly. Hotkeys don't seem to work at all.

Then I look at the appdb in WINE and I see that people put it as Platinum (wtf?), and I look a bit deeper and see that the person used "AutoHotkeyX" as the version. So what is that exactly? It seems to be like a special build for Linux that uses WINE and other programs to execute it instead... or something.

I have no idea how to download it or how to use it, it also mentions "Autohotkey.dll" which I can't find in my autohotkey folder (in WINE) so I really have no idea how this all works but I would appreciate if someone gave me step by step on how to get this "AutoHotkeyX" to work and make my ahk scripts work in WINE.

I really need this as it is the only solution I found that can read/execute ahk files! I can't really switch to another scripting/automation tool like AutoKey because I do not know Python and it would be a pain to learn, and that would mean I'd have to convert all my ahk scripts which would be horrible.

If someone knows or used it, please step by step if possible, thank you.


Again sorry if this is obvious in a way, but I'm not that used to Linux since I come from Windows and well... that's why I use WINE so much since it feels more "at home" with the apps organized like on Windows. I'll get better at linux in time though!
 
Old 06-24-2014, 12:34 PM   #2
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,213

Rep: Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343
The comments on winehq and autohotkey.net don't seem promising. The version ahkx hasn't been touched for 5 years, which seems even less promising. You might look at this
http://www.autohotkey.com/board/topi...of-autohotkey/
 
Old 06-24-2014, 12:54 PM   #3
kktsuri
LQ Newbie
 
Registered: Jan 2014
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: Disabled
Does IronAHK support hotkeys, though? I don't want anything complicated, just basic stuff like... press ENTER and do a specific macro (sending specific keys and mouse clicks), that's about it. As said, unfortunately this doesn't seem to work in WINE.

I checked your link but none of the download links work, and going to ironahk.net is pretty confusing for me, I have no idea what to download from there (I'm not too used to git and this open source stuff and compiling with make, I only have knowledge of Windows compiling with MSVC etc).

Lastly, IronAHK seems to be abandoned as well but I'm not sure what kind of features it supports yet, if you could link me to a specific link to download in simplest way I'd appreciate it so I can do a test drive, thanks!
 
Old 06-25-2014, 12:29 PM   #4
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,213

Rep: Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343
It's not actually abandoned, since people are still posting questions, but the development does seem bogged down. Frankly, after a closer look, I wouldn't care to attempt to use it. I've done quite a bit of compiling, but I'm not familiar with this git business. I'm sorry to be of so little help, but — as you see — no-one else even seems interested.

If you work mainly with Wine and miss AutoHotkey, perhaps you would be happier staying with Windows?
 
Old 06-26-2014, 08:27 AM   #5
kktsuri
LQ Newbie
 
Registered: Jan 2014
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: Disabled
Well, I'm trying to move to Linux slowly, but old habits die hard

So it would be nice to have almost similar functionality I'm used to under Windows without dual booting, because it would be a shame for me to switch back just because of this seemingly "simple" task. I know it's not simple but well, I figured Autohotkey was open source so a port wouldn't be too hard back then

Anyway, now I have some question about AutoKey. I have zero idea how to use it, but it seems it supports using hotkeys. Now, how exactly do you use the python script thing? I don't know python but I can learn it quick for basic tasks I guess.

Perhaps even do something like... use hotkey from AutoKey, then trigger some part of autohotkey ahk file since the rest seems to work (just not hotkeys).

If that fails I'll just have to convert ahk scripts to python sigh. But for that I'll need some basic tutorials how to use AutoKey and python with it, know anything?

A simple AutoKey example with a script that would do something like the following would be great for me to understand:

Hotkey ENTER:
Click once
Wait/Sleep 1 sec
Send the ENTER key (original one, not hotkey so it's not recursive)

From this basic macro I can easily understand more.
 
Old 06-26-2014, 12:48 PM   #6
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,213

Rep: Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343Reputation: 2343
The site seems to have links to guides, including sample scripts:
https://code.google.com/p/autokey/
 
1 members found this post helpful.
Old 06-26-2014, 06:57 PM   #7
kktsuri
LQ Newbie
 
Registered: Jan 2014
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: Disabled
As stupid as it may sound, I didn't even know its webpage because for some reason there was a forum post with it that I thought was like IronAHK. Sorry about that.

1 weird thing I find in those Sample Scripts is that there's no hotkeys there, I guess they are triggered differently not like in ahk with a single file containing everything. Thanks though, now time to learn them
 
Old 06-30-2014, 09:08 AM   #8
kktsuri
LQ Newbie
 
Registered: Jan 2014
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: Disabled
Ok, looks like most of AutoHotkey works but now I'm wondering if there's a way to trigger hotkeys via some Linux way and just execute the part of AutoHotkey with the hotkey itself.

winetricks seems to use autohotkey a lot with "ahk_do" I'm not sure how it works exactly, as I'm not too familiar with Bash.

Unfortunately the mouse API of AutoKey is very very limited, no way to move the mouse or to get the mouse position or to hold down click as far as I seen. That means dragging is impossible to simulate.

xdotool seems to be great, actually, but again my problem is how to set the HOTKEYS to trigger specific actions, not how to send the keystrokes/mouse stuff only.

And I don't mean just complicated hotkeys like "CTRL+L" or something like that. I know I can do that with the Keyboard configuration in Linux Mint. However, I have some scripts that are quite "smart" when I press click and do different things depending on many factors, such as the window active and the position of the mouse cursor in it, etc. Most of the time it would send a simple normal "Click down" of course (and Click up when it's released), so the script would effectively work when I press down Click only in certain window at certain position etc. The problem is I can't just hotkey left mouse click can I? (I could on Windows with autohotkey)

What's best tool to handle hotkeys (even e.g replacing normal left click under certain circumstances, or do I have to do that in the script? and if I do in the script, it will not call itself recursively right? It will call the original click?)
 
Old 09-18-2014, 08:59 AM   #9
TJGeezer
LQ Newbie
 
Registered: Jan 2013
Location: Rosarito Beach, BCN, Mexico
Distribution: Mint
Posts: 2

Rep: Reputation: Disabled
Smile

I just saw this post and don't know if you're still following, but I made the transition from Windows 7 to Mint a year or so ago and had the same problem. Now I find myself using a combination of tools to approximate my rather hefty collection of AHK macros and AHK in a virtualbox Windows VM when I can't get around using MS apps or Windows utilities.

But I can get most of the automation I need by combining bash scripts and aliases (including simple functions in a ~/.bash_aliases file) with different utilities. AutoKey uses a simple "exec" command (copied from its sample scripts) to execute a bash script that tells xdotools or xte to simulate mouse or keyboard movements. AutoKey can filter its macros to work only in specified windows. xdotool you're familiar with. xte is part of the xautomate package and is quick and simple for things like moving windows using a specified mouse button. From the xte -h screen:

drag from 100,100 to 200,200 using mouse1:
xte 'mousemove 100 100' 'mousedown 1' 'mousemove 200 200' 'mouseup 1'

For more complicated stuff like changing window geometries and so forth, in Mint 17 I mostly use the wmctrl utility. In Min 16, a great little utility called devilspie with a gdevilspie GUI would automatically change the position and geometry of any window I specified, on opening. Unfortunately, devilspie doesn't work in Mint 17. I keep hoping it'll get fixed in Mint 17 and wishing I knew how to fix it myself.

Hope some of this might help you make the transition.

Incidentally, the problem with wine and AHK is, wine can't access lower-level functions, so you can't use ahk's keyboard or mouse hooks. But I've got to the point where I don't much miss AHK; I simply do the same things with bash aliases or scripts. It's not very hard to kluge together macros using combinations of --

AutoKey (with filtering for specific apps)
xdotool
xte (from xautomation)
wmctrl (for quite good window position and geometry control)
zenity (to pop up readable message boxes)

Oddly, now that I'm used to the approach it seems no harder to use than AHK was. But then I've just gotten to where playing with Linux is as much fun as DOS was back in the days of the dinosaurs. I'd missed that with later stay-inside-the-lines Windows versions.
 
Old 11-03-2014, 01:54 PM   #10
kktsuri
LQ Newbie
 
Registered: Jan 2014
Distribution: Mint
Posts: 22

Original Poster
Rep: Reputation: Disabled
I just came around to read your post, never heard about xte, I thought xdotool would be adequate for mouse drags as well -- I actually haven't really got around to replace all my scripts, so far I've been using a VM for the ones with dragging.

Thanks for the post, now I know what I tried to do wasn't half-assed or inefficient, so I can start to replace the remaining scripts I have then
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
AutoHotkey like utility for X? kcin Linux - Software 2 02-18-2008 02:29 AM
Hey there, I'm here to promote my autohotkey-like program peabodyman LinuxQuestions.org Member Intro 1 02-18-2008 02:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration