installing AHKv2 and setting up a .ahk2 extension

Put simple Tips and Tricks that are not entire Tutorials in this forum
SSpeed
Posts: 25
Joined: 04 Jul 2018, 09:48

installing AHKv2 and setting up a .ahk2 extension

29 Jul 2019, 13:00

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.

https://youtu.be/hCMfuVirzBs

(i'm using windows 7)
joefiesta
Posts: 383
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: installing and setting up AHK v2

30 Jul 2019, 09:06

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.
SSpeed
Posts: 25
Joined: 04 Jul 2018, 09:48

Re: installing and setting up AHK v2

30 Jul 2019, 10:11

the height of the issue would probably be in setting up the .ahk2 context menu.

here is a clip of such:. https://youtu.be/x_KMq8_KS7E

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


(mod may move this thread)
User avatar
nnnik
Posts: 4475
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: installing AHKv2 and setting up a .ahk2 extension

30 Jul 2019, 11:02

The default extension of ahkv2 files will be .ahk
Recommends AHK Studio
User avatar
JoeWinograd
Posts: 1630
Joined: 10 Feb 2014, 20:00

Re: installing AHKv2 and setting up a .ahk2 extension

30 Jul 2019, 11:42

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:
https://autohotkey.com/boards/viewtopic.php?f=5&t=53788

Then this bug report on it:
https://autohotkey.com/boards/viewtopic.php?f=14&t=53840

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
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: installing AHKv2 and setting up a .ahk2 extension

30 Jul 2019, 12:35

- 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.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4475
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: installing AHKv2 and setting up a .ahk2 extension

30 Jul 2019, 12:49

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.
Recommends AHK Studio
SSpeed
Posts: 25
Joined: 04 Jul 2018, 09:48

Re: installing AHKv2 and setting up a .ahk2 extension

30 Jul 2019, 13:17

The default extension of ahkv2 files will be .ahk
grazie


well that's good enough for me. thanks everyone
Adventurer
Posts: 5
Joined: 18 Apr 2019, 06:24

Re: installing AHKv2 and setting up a .ahk2 extension

20 Jan 2020, 08:36

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
User avatar
TheArkive
Posts: 384
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: installing AHKv2 and setting up a .ahk2 extension

13 Feb 2020, 15:57

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.
Attachments
AHK-custom-install.zip
(882 Bytes) Downloaded 94 times
User avatar
hoppfrosch
Posts: 406
Joined: 07 Oct 2013, 04:05
GitHub: hoppfrosch
Location: Rhine-Maine-Area, Hesse, Germany
Contact:

Re: installing AHKv2 and setting up a .ahk2 extension

13 Feb 2020, 22:54

@TheArkive:
Just for completeness: AHK-EXE-Swapper (by EvilC) allows easy switching between different AHK-Versions - with only one version active

GitHub: https://github.com/ahkscript/AHK-EXE-Swapper
Forum post: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=6310
User avatar
TheArkive
Posts: 384
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: installing AHKv2 and setting up a .ahk2 extension

18 Feb 2020, 00:40

@hoppfrosch Thanks for that! I was about to write my own one of these. I still might, but this looks like a great option.
User avatar
TheArkive
Posts: 384
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: installing AHKv2 and setting up a .ahk2 extension

27 Feb 2020, 17:31

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.

Return to “Tips and Tricks”

Who is online

Users browsing this forum: No registered users and 4 guests