Script to import hotstrings from autohotkey

306 views
Skip to first unread message

Al

unread,
Aug 23, 2012, 11:50:32 AM8/23/12
to autoke...@googlegroups.com
Is any script available for importing simple AutoHotKey strings (e.g. "btw::by the way") into Autokey?

A script htat performs this function (autokey import_hotstrings.py) appears to have been available on the old forum at Sourceforge, but now it seems to have disappeared.

Thanks,
Al

Rob Wilmshurst

unread,
Feb 7, 2013, 3:06:04 PM2/7/13
to autoke...@googlegroups.com
Like you I was unable to find the old python script. I could not find anything else either.

As I've around 2000 AutoHotkey hotstrings, mainly for the purpose of typo/capitalisation fixing, I did want a script to convert them over.

So I have written for myself a script (in C#, as that's the language I have familiarity with) that can extract hotstrings from the AutoHotkey.ini file and generate the text file and JSON file that Autokey uses. It handles the *, C, ? flags that AutoHotkey hotstrings supports. It runs under MonoDevelop. If there's any interest from others I can post it here.

Rob

Vincent Willems

unread,
Oct 5, 2018, 8:59:58 AM10/5/18
to autokey-users
Do you still have your script ?
I'm trying to convert my autohotkey file (I have windows at work, but only Linux at home) ?

thanks in advance

Joe

unread,
Oct 5, 2018, 11:30:19 PM10/5/18
to AutoKey Users
This post is very old. It will be great if the OP replies, but I
wouldn't count on it.

AFAIK, we never got the code here on the list.

There have been a number of similar requests in the past, so If you do
come up with anything that works, please let us know.

AutoKey scripts are written in Python3, so automatically translating
from whatever AutoHotKey scripting uses would probably be a lex/yacc
thing - non-trivial.
However, phrases should be more doable.

AutoKey stores each phrase as a pair of files - phrase-name.txt and
.phrase-name.json. The text file (almost always) just contains the
replacement text and the json file contains all the metadata like the
trigger, etc. (and json is a human-readable text file format.) Note that
the json file name begins with a period - which makes it a hidden file.

It should be possible to create one phrase manually and then use the two
files AutoKey creates for it as templates where just a few things need
to be altered for each new phrase.

Once all the phrases are translated, just put them in an AutoKey phrases
directory and it will automatically find them. You just have to close
and reopen the main AutoKey menu and they should appear.

I don't think anyone has done this, but it seems like it wouldn't be too
difficult. A bash script written using awk or sed and input parameter
files would probably be sufficient.

I don't have time to do this from scratch (and I've never looked at
AutoHotKey), but I'm pretty good with the above tools and would be happy
to assist in getting such a translation script to work.

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Rob Wilmshurst

unread,
Oct 6, 2018, 5:41:55 AM10/6/18
to autokey-users
I attach what I used: C# solution & project files, the main file and the dummy unit test file I used to run the code.

Hope that's of some use to you. Please assume the code is licensed as GPL v2.0.

Rob
Autokey.sln
AutokeyUnitTests.cs
Autokey.csproj
Autokey.cs

Vincent Willems

unread,
Oct 7, 2018, 9:29:35 AM10/7/18
to autoke...@googlegroups.com
Thanks a lot !
I'll try to figure how to compile a C# programm Under Linux (for now, I only compiled C programs using ./configure && make && make install

--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.

Joe

unread,
Oct 7, 2018, 7:38:21 PM10/7/18
to autoke...@googlegroups.com
Keep us updated.

If this doesn't work, making a CSV file and a bash script sounds quite
doable (for me, anyway) - especially since the phrase code you showed is
very regular and simple.

Joe
> <mailto:autokey-user...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
Reply all
Reply to author
Forward
0 new messages