[Tool] AHK-EXE-Swapper. Swap AHK version quickly!

Post your working scripts, libraries and tools
User avatar
evilC
Posts: 3600
Joined: 27 Feb 2014, 12:30

[Tool] AHK-EXE-Swapper. Swap AHK version quickly!

05 Feb 2015, 23:34

AHK-EXE-Swapper allows you to quickly and easily swap which version (ie 1.2.3) and variant (ie Ascii / Unicode / x86 / x64) of AutoHotkey you wish to use for all scripts. It also allows you to replace your AHK EXEs with those from zips of Lexikos' test releases of AHK and HotkeyIt's releases of AHK_H

Previous versions that you have used will be backed up in a library, and you can swap out to them as long as no scripts are currently using Autohotkey.exe

GitHub Page

Image
Last edited by evilC on 28 Aug 2016, 14:22, edited 2 times in total.
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
GitHub: visionary1
Location: Seoul
Contact:

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

06 Feb 2015, 02:44

this is cool!

also, you can change the basically used 'AutoHotkey.exe' by modifying the registry

on HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Open\Command
the default data is "C:\Program Files\AutoHotkey\AutoHotkey.exe"

so you can change it by using RegWrite
for example, C:\Program Files\AutoHotkey\AutoHotkeyA32.exe" will use ANSI version of AHK by default
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
joedf
Posts: 6031
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

06 Feb 2015, 03:20

added to "[AutoHotkey Programming Tools]" (viewtopic.php?f=6&t=3376)
User avatar
evilC
Posts: 3600
Joined: 27 Feb 2014, 12:30

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

12 Feb 2015, 17:47

First off, the instructions are now right, you do only need the EXE and not the get_info.ahk file - everything is now internal.

Secondly, AHK-EXE-Swapper now has basic support for AHK v2 .
Back up your current AHK version ,delete the 3 EXEs in the AHK folder.
Download BOTH v2 EXEs and rename them AutoHotkeyU32.exe and AutoHotkeyU64.exe, place them in the AHK folder.
Run the script (or refresh) and it will detect V2 installed. Hit "Backup" and it will add the v2 EXEs to your library - you can now swap v1 and v2 in and out easily.
User avatar
evilC
Posts: 3600
Joined: 27 Feb 2014, 12:30

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

28 Aug 2016, 13:46

Updated repo - the EXE swapper now supports AHK_H.

The naming format of the folders in the Versions folder has changed, whereas before it was like 1.1.23.05, it is now like 1.1.23.05 (AHK_L) or 1.1.24.00 (AHK_H v019) (Always 3 spaces, less and the UI looked too cluttered)

I also made it run as admin if needed, and added a debug mode var at the start for simpler / non-SciTE debugging.

[Update] It now swaps in the correct version of msvcr100.dll needed for AHK_H also
User avatar
joedf
Posts: 6031
Joined: 29 Sep 2013, 17:08
Facebook: J0EDF
Google: +joedf
GitHub: joedf
Location: Canada, Quebec
Contact:

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

28 Aug 2016, 18:23

Keep up the good work :+1:
iPhilip
Posts: 222
Joined: 02 Oct 2013, 12:21

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

29 Nov 2016, 14:12

Hi EvilC,

I am interested in using your tool but can't seem to get it to run. I downloaded a copy from your GitHub page, made sure that I had no running scripts, and tried to run both the .exe and the .ahk versions. When I click on one of the variants I get the error: "Could not delete AutoHotkey.exe. Do you have any scripts running? If so, stop them and try again". I am running AHK 1.1.24.03 and A_AhkPath is C:\Program Files\AutoHotkey\AutoHotkey.exe.

Thank you for your help.
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)
iPhilip
Posts: 222
Joined: 02 Oct 2013, 12:21

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

30 Nov 2016, 11:22

Thanks. That worked.

I was thrown off by your comment above:
evilC wrote:I also made it run as admin if needed ...
Cheers!
Windows 7 Pro (64 bit) - AutoHotkey v1.1+ (Unicode 32-bit)
Albireo
Posts: 329
Joined: 16 Oct 2013, 13:53

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

03 Apr 2017, 06:19

I do not get AHK-exe to work. (and am not sure that I understand the function).
Now I have three files (version1) in the C:\Program Files\AutoHotkey
AutohotkeyA32-1.exe, AutohotkeyU32-1.exe, AutohotkeyU64-1.exe
and two files
AutohotkeyU32-2.exe, AutohotkeyU64-2.exe
and one file
Autohotkey.exe
If I run this program, I believe that the current AHK version appears
Now if I want to change the version, the Autohotkey.exe is deleted, and any of the other versions is copied to the name Autohotkey.exe
(it seems to work)

But if I try to run AHK-EXE-Swapper as administrator, it doesn't work for me.
I got an error message "... Backup Versions do not match main AHK-Version. or files are missing! ..."
In the "version" field I have both "1.1.25.01....." and "2.0-1078-19....."

//Jan
User avatar
evilC
Posts: 3600
Joined: 27 Feb 2014, 12:30

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

03 Apr 2017, 13:30

It works like this:

1) Install AHK as normal
2) Launch the app, click "Backup Current Version".
This copies the AHK exes from the install folder to C:\Program Files\AutoHotkey\AHK-EXE-Swapper\Versions
3a) If a new AHK_L version comes out, download it and run the installer.
Then go into the app and click "Backup Current Version" again.
3b) For AHK_H releases, or AHK_L betas (Without installer) and maybe this applies to v2 AHK as well?
Copy the zip into C:\Program Files\AutoHotkey\AHK-EXE-Swapper\Import
Then open the app, click "Refresh all", then select the zip, then click "Import Selected Version"
4) Once versions are in your library, you can select them from the top list and select "Replace with selected version".

So basically, the mistake you are making is that it does not rely on files in the C:\Program Files\AutoHotkey folder, but it stores "Other versions" in C:\Program Files\AutoHotkey\AHK-EXE-Swapper\Versions
You populate versions by overwriting ALL the current EXEs (AutoHotkeyA32.exe, AutoHotkeyU32.exe, AutoHotkeyU64.exe) with new ones, and then clicking "Backup Current Version".
This will add it to the "library" of versions.

But if I try to run AHK-EXE-Swapper as administrator, it doesn't work for me.

You do not need to do this, it already self-elevates to admin.
pk23
Posts: 47
Joined: 24 Apr 2015, 00:49

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

14 Apr 2017, 05:37

My ahk release version is installed in `d:\TechnicalSupport\ProgramFiles\AutoHotkey`, using the official installer exe, but the AHK-EXE-Swapper seems not detect this install path correctly.

I place AHK-EXE-Swapper in `d:\Downloads\AHK-EXE-Swapper`. When I click `backup` in AHK-EXE-Swapper's UI, not only does it create the correct backup (possibly because it cannot find the install path), but at the same time it creates three folders under the `C:\Program Files\AutoHotkey\AHK-EXE-Swapper`.

Run regedit in my machine, `HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell\Open\Command` says "d:\TechnicalSupport\ProgramFiles\AutoHotkey\AutoHotkey.exe" "%1" %*

Win7x64 AutoHotkey v1.1.25.01
User avatar
evilC
Posts: 3600
Joined: 27 Feb 2014, 12:30

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

14 Apr 2017, 09:06

The code EnvGet, AhkFolder, ProgramW6432 is used by the code to detect the program files folder, then appends AutoHotkey to it.
I guess this does not work in your case.

The problem is that the app must be run WITHOUT using your AHK install, as it needs to change the AHK EXE.
So as I am not running using the installed version of AHK, I cannot use A_AhkPath to detect the AHK install folder.

What I may have to do is something like have the code write an AHK script that reads A_AHKPath, save it to temp folder and run it, then retrieve the path to AHK like that.
Failing that, I would need to start looking in the registry or something to find the AHK folder.
User avatar
evilC
Posts: 3600
Joined: 27 Feb 2014, 12:30

Re: [Tool] AHK-EXE-Swapper. Swap AHK version quickly!

14 Apr 2017, 09:17

Am a bit busy at the moment, so I asked if anyone else has a code snippet to solve this.
In the meantime, you could fix it by downloading the .ahk version of the script, and right at the start, alter the line AhkFolder .= "\AutoHotkey" here.
Then recompile the script and you should be good.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Delta Pythagorean and 13 guests