Page 1 of 1

installing AHKv2 and setting up a .ahk2 extension

Posted: 29 Jul 2019, 13:00
by SSpeed
i found that the process was a bit difficult... inefficient...
I made a video showing the process in the hope that the process might be improved.

(i'm using windows 7)

Re: installing and setting up AHK v2

Posted: 30 Jul 2019, 09:06
by joefiesta
I don't get it.... it took you 1 minute and 37 seconds.... that's a damn fast install. And, boy, do you type fast. (The real point is: the video is 1) unwatchable at default speed and 2) really would be much better if we knew what your problems were.)

Secondly, this entry does not belong in BUG REPORTS. Nothing is broken.

Re: installing and setting up AHK v2

Posted: 30 Jul 2019, 10:11
by SSpeed
the height of the issue would probably be in setting up the .ahk2 context menu.

here is a clip of such:.

which is better:. that people must take these steps, or that it is automated (such as during installation)

(mod may move this thread)

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 30 Jul 2019, 11:02
by nnnik
The default extension of ahkv2 files will be .ahk

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 30 Jul 2019, 11:42
by JoeWinograd
Hi SSpeed,
I haven't watched your videos, but just wanted to comment on the .ahk2 extension that is in the title of this thread.

I'm using V1 and V2 on the same system and my suggestion is: don't use ahk2 as the file type. The first thing I tried was ahkv2...had a problem. Next thing I tried was ahk2...had the same problem. I posted this question on it:

Then this bug report on it:

As you can see from the replies by lexikos, he figured out that the problem is due to the 8.3 short file name. I changed my AHK V2 file type to ah2 and haven't had a problem since. Regards, Joe

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 30 Jul 2019, 12:35
by jeeswg
- Since AHK v2 is beta, the installer doesn't have to be perfect yet. There doesn't even need to be an installer.
- But a good installer is a fine idea. If you did want a custom installer, it would be best to write a custom script, that uses RegWrite and checks A_IsAdmin, and share it here. And people could modify it to suit their preferences. Cheers.

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 30 Jul 2019, 12:49
by nnnik
Potentially you could also modify the installer and share it on the forums. Many people seem to need or use a custom extension for multiple versions of the language.
Perhaps it would also be possible to ship Quick-Version-Swapper (or is it switcher) with AHK.
It allows the user to switch to any version of the language quickly once they have imported it.

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 30 Jul 2019, 13:17
by SSpeed
The default extension of ahkv2 files will be .ahk

well that's good enough for me. thanks everyone

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 20 Jan 2020, 08:36
by Adventurer
nnnik wrote:
30 Jul 2019, 11:02
The default extension of ahkv2 files will be .ahk
Not sure if it's appropriate to bump a 6 month old thread, but this information is still very valuable and it's something I tried to do myself before.

In my opinion, I think AHKv2 should always register .ahk2 as a format, and register .ahk as well if AHKv1 is not present on the system (or have an option but its default selection is determined by whether or not AHKv1 is installed).

As a less important aside, I also think AHKv2 should get a unique installation directory that isn't C:\Program Files\AutoHotkey, maybe one of these...

C:\Program Files\AutoHotkey v2
C:\Program Files\AutoHotkeyV2
C:\Program Files\AutoHotkey 2
C:\Program Files\AutoHotkey2
C:\Program Files\AHKv2

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 13 Feb 2020, 15:57
by TheArkive
Here's one of the few "easy" ways to not only setup any version of AHK to work on your system, but to also easily switch back and forth.

NOTE: This assumes you have made (or will make) custom folders for your different versions of AutoHotkey (the EXE file of course). This method is meant to allow you to switch versions quickly and easily, NOT to use multiple versions at the same time.

Like many other users on this forum, I do NOT recommend that you try to apply other extensions other than the .ahk extension. Most users on this forum will only release .ahk files for their scripts. Furthermore, AutoHotkey_H has several libraries, all with the .ahk extension. Trying to use another extension would mean renaming all those files, and modifying all the #INCLUDE entries for all those dependencies and libraries. You would also have to do this for MOST future AHKv2 script, since most users will still use the .ahk extension.

From almost any angle, it's more trouble than it's worth trying to setup another extension. I actually considered (and tried it) for a short while, only becuase I had not yet developed the below method at that time. For me, the below method is FAR better than setting up a separate extension for AHKv2.
Here's an easy solution to swith AHK versions quickly:

1) Download the attached file.

2) Place a copy of the .reg files in each AHK version folder you use. For example I have the following folders:
AutoHotkey v1.1.32.00
AutoHotkey v2.0-a108-a2fa0498

3) Open the _AHK_Install.reg file in a text editor and fill in the two entries that point to the AutoHotkey.exe file for EACH version of AutoHotkey you are intending to run (which also associates it with the .ahk extension). So if you are running AHKv1 and v2, you should have a minimum of two of these files. You only need one _AHK_Uninstall.reg file. In theory you can modify one of these .reg files for every type of AutoHotkey EXE file, so you can switch between ANSI, UNICODE, 32-bit, and 64-bit. How you choose to set this up is up to you.

IMPORTANT NOTE: If I'm not mistaken, when you use the AHK installer, the version of AHK you select (Unicode x86, Unicode x64, or ANSI) is copied to AutoHotkey.exe.
The ANSI version (32-bit) is: AutoHotkeyA32.exe <-- this version comes with AHKv1
The 32-bit Unicode version is: AutoHotkeyU32.exe <-- this version comes with AHKv1 and v2
The 64-bit Unicode version is: AutoHotkeyU64.exe <-- this version comes with AHKv1 and v2

Do one of the following:
a) Simply copy/paste the version you want to use within the same folder, and rename it to AutoHotkey.exe. The other versions are technicallly not needed, but if you want to switch (testing, preference, or any reason) then it's handy to keep those files around.

b) Specify a specific AutoHotkey EXE file (ie. AutoHotkeyU32.exe, or AutoHotkeyU64.exe) in the .reg file witout making a separate copy. Be sure to change all the appropriate entries.

4) Optionally, in the .reg file, change the line that points to notepad.exe to point to your own custom text editor. The default is C:\Windows\notepad.exe. Remember that when modifying a path in a .reg file, you must use two backslashes \\ to separate folders, not one.

5) Optionally, in the .reg file, change the "ShellNew" entry to use a custom template. Check the comments (starting with semi-colon ;) for which paths to change.

This method works best with zip files. Using the EXE installers is not necessary.

All AutoHotkey Versions (linked from the AutoHotkey Download page):
AutoHotkey 1.1.*
AutoHotkey 1.0.*
AutoHotkey 2.0-a*


EDIT: Updated the _AHK_Install.ahk to include the "ShellNew" entries in the .ahk file type. This defines the template used when using the Right-Click menu in the File Explorer and selecting New > AutoHotkey Script. This can be customized to use templates you specify in a custom location.

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 13 Feb 2020, 22:54
by hoppfrosch
Just for completeness: AHK-EXE-Swapper (by EvilC) allows easy switching between different AHK-Versions - with only one version active

Forum post:

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 18 Feb 2020, 00:40
by TheArkive
@hoppfrosch Thanks for that! I was about to write my own one of these. I still might, but this looks like a great option.

Re: installing AHKv2 and setting up a .ahk2 extension

Posted: 27 Feb 2020, 17:31
by TheArkive
I've created a portable installer with all the bells and whistles I've been hoping for. Hope this helps simplify things for some folks.