AHK Portable Installer v1.29

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.20

Post by TheArkive » 20 Oct 2021, 04:44

You should be able to use ahk-pi to launch the version of AHK exe or compiler that is associated with the #Requires directive in your script. Something like this:

Below is what is in the registry.

Code: Select all

"X:\path\to\AHK_Portable_Installer\AHK Portable Installer.exe" "X:\path\to\AHK_Portable_Installer\AHK Portable Installer.ahk" [Compile|Launch] "%1"
I imagine you would simply omit the "%1" at the end. Select the last param as Compile or Launch accordingly.

I'll have to test this out fully to make sure it functions as intended. If you want no fuss, just manually specify the EXE paths you want to use.

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.21

Post by TheArkive » 27 Oct 2021, 13:28

v1.21
  • Added missing setting on 1st init: "UpdateCheckDate"
  • Fixed update checks to be asynchronous, so the UI won't freeze when checking for updates and the AHK server is sluggish or down.
  • Now, when using the installer, changing the installed version takes effect immediately. No need to close the UI first.
  • Built option to add "AHK Portable Installer" path to PATH environment variable. The "Install For" option affects adding to the user PATH or system PATH.
  • Built option to copy installed EXE to "AHK Portable Installer" dir as "AutoHotkey.exe".
  • Renamed script to "AHK_Portable_Installer.ahk" (removed spaces) to make command line usage more consistent.
  • Updated readme for command line usage instructions.

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.22

Post by TheArkive » 28 Oct 2021, 06:50

v1.22
  • Built option to register "AutoHotkey.exe" with .ahk files, instead of using the launcher.
  • Fixed "Run Script as Admin" to follow settings for PATH and "Register AutoHotkey.exe".
  • Updated readme to include explanation of Installer Options and updated Command Line Usage docs.
  • NOTE: This update adds an option to turn this program in to an "EXE switcher" similar to "AHK-EXE-Swapper". This overrides the Launcher and only uses the installed version to launch scripts. You can still use the UI to quickly and easily change the installed version of AutoHotkey.

    Another NOTE: Switching while a script is running will fail, so don't do it. If you need to run multiple different scripts of different AHK version simultaneously, then don't use this feature. Instead use the #Requires directive. See the GitHub repo README for more info.

Edit: The final update to the README has been pushed. I've changed/removed outdated information, added some important clarifications, and fixed some markdown formatting issues.

FrankNFurter
Posts: 5
Joined: 17 Oct 2020, 02:22

Re: AHK Portable Installer v1.22

Post by FrankNFurter » 09 May 2022, 12:27

@TheArkive I'm really confused here, You say in your posts to run the EXE of the Portable Installer, then no where in your GitHub or in the into post linked files is an EXE. How are we supposed to use this without going through the whole process and getting AHK2EXE and compiling it ourselves?

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.22

Post by TheArkive » 09 May 2022, 12:32

From the Github page.
image.png
image.png (13.13 KiB) Viewed 3132 times
EDIT:
If ya still have questions let me know. I tried to make this as easy to follow as I could. I guess the instructions could be improved.

FrankNFurter
Posts: 5
Joined: 17 Oct 2020, 02:22

Re: AHK Portable Installer v1.22

Post by FrankNFurter » 09 May 2022, 12:39

Thanks Arkive! I'll do that now, i'm making the jump from doing all of my AHK in v1 so this will be a fun ride :)

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.22

Post by TheArkive » 09 May 2022, 12:44

@FrankNFurter

Gotcha :thumbup: Yah that process can be tricky. I tried to make this as functional as possible. The one thing this script lacks compared to a legit install is UI Access. Although this isn't a problem if you are running in Admin mode (UAC disabled).

DaveT1
Posts: 218
Joined: 07 Oct 2014, 11:23

Re: AHK Portable Installer v1.22

Post by DaveT1 » 10 May 2022, 08:53

FrankNFurter wrote:
09 May 2022, 12:39
Thanks Arkive! I'll do that now, i'm making the jump from doing all of my AHK in v1 so this will be a fun ride :)
I made the jump a few months ago. Very pleased to be in v2, though I guess I don't use too many libs so that's not a particular pain-point for me.

BUT, did want to say just how very helpful @TheArkive was when I was trying to get my brainless head around this script - he went above and beyond (I probably drove him beyond ;) ) :bravo:

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.22

Post by TheArkive » 10 May 2022, 10:06

@DaveT1
Nah, it's all good. You were fine. Glad you are up and running. :thumbsup:

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.23

Post by TheArkive » 12 Jun 2022, 13:12

v1.23
  • Ahk2Exe is now automatically downloaded, and extracted to install dir if no "Compiler" folder exists.
    MPRESS and UPX are currently not included for automatic downloads.

    Thanks to lexikos' release of AHK v2-beta.4, I got the idea of a short and direct way to check for Ahk2Exe updates from his code/release.

FrankNFurter
Posts: 5
Joined: 17 Oct 2020, 02:22

Re: AHK Portable Installer v1.23

Post by FrankNFurter » 18 Jun 2022, 17:14

Just a heads up, you are calling AHK2EXE.url but never setting it (you use .update_url). It's also failing file hash "math" which i'm assuming is matching. Latest version won't work no matter what I try.

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.23

Post by TheArkive » 19 Jun 2022, 05:16

@FrankNFurter

Thanks for that, found some other errors too. Working on it.

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.24

Post by TheArkive » 19 Jun 2022, 05:56

v1.24
  • fixed selected file downloaded never being downloaded (thanks to @FrankNFurter)

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.25

Post by TheArkive » 25 Jun 2022, 11:40

v1.25
  • MPRESS and UPX are now automatically downloaded if they doesn't exist, and is automatically extracted to the Compiler folder
  • Cleaned up some code, removed unused bits
  • Reorganized some settings
  • Updated readme
  • Note that MPRESS, Ahk2Exe, and UPX are only implemented when the user selects to download a version of AHK.

DaveT1
Posts: 218
Joined: 07 Oct 2014, 11:23

Re: AHK Portable Installer v1.25

Post by DaveT1 » 20 Sep 2022, 15:25

Hope that this is not too-wrong a thread to post this is, but since a recent Windows 10 update, double-clicking any .ahk file opens it in Scite4AHK rather than running the script which is what would have happened before the update.

I use AHK PI to manage my different versions of AHK. I've currently got AutoHotkey_2.0-beta.7 downloaded and have clicked the Install button. Per these comments from AHK PI:
When you click Install the base version is set and the script writes registry entries for the .ahk extension, and context menu entries (such as Right-Click > New, and "Run Script", "Compile Scrpt", etc).
But I have none of these context menu options appear :think:.

I'm not sure that this is an AHK PI issue as such, I think that the recent Windows update has screwed something up - probably in the registry?! But posting here in the hope that someone can point me in the right direction.

Many thanks in advance.

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.25

Post by TheArkive » 21 Sep 2022, 01:11

@DaveT1

Ya updates can do weird things sometimes.

A few questions:

1) do you have any other programs that use the ahk extension? That can be the source of a conflict.

2) Do you happen to have admin permissions on your account? You shouldn't need it,, but it depends on how you use ahk and what you are trying to do.

Herest what i would try first.

1) Use the uninstall button to clear everything out of the registry.

2) Check the main reg keys manually and clear out remaining entries.

3) reinstall as usual, make sure to set your preferred text editor in the UI before clicking install.

===========================

When i get home today i can provide more detailed instructions.

Lastly, aside from context menu entries, are you able to use the ahk extension normally?

DaveT1
Posts: 218
Joined: 07 Oct 2014, 11:23

Re: AHK Portable Installer v1.25

Post by DaveT1 » 21 Sep 2022, 04:26

OMG, you are, as usual, most helpful. I'll give the best answers I can to your helpful Qs:
TheArkive wrote:
21 Sep 2022, 01:11
1) do you have any other programs that use the ahk extension? That can be the source of a conflict.
No. I've been running ahk scripts for years. 1st noticed this yesterday when I found an ahk script open in Scite4AHK. This script is in my startup sequence and normally just runs when my laptop restarts (typically after a Windows update!). But obvious 'cos something is now screwy with my system the restart didn't know what to do with this ahk script, so opened it in Scite4AHK.
2) Do you happen to have admin permissions on your account? You shouldn't need it,, but it depends on how you use ahk and what you are trying to do.
Yes I do. Using install in AHK PI requires you to be administrator. And this works fine as long as I remember to launch your script as admin.
1) Use the uninstall button to clear everything out of the registry.
OK. uninstall from AHK PI?
2) Check the main reg keys manually and clear out remaining entries.
Ah, now here I have to say I've no clue where to look. I can run RegEdit no probs and browse to locations. But which locations to look for and then what to check is somewhat over my head. Is there a standard list of registry locations and values where ahk info is set?
3) reinstall as usual, make sure to set your preferred text editor in the UI before clicking install.
Do I install using AHK PI?
Lastly, aside from context menu entries, are you able to use the ahk extension normally?
Really sorry, but I'm not sure what you mean. I can open ahk files in vscode (my prefered IDE) and run and debug in there. But the vscode extensions I use explicitely point to locations on my c drive that have the ahk executables. What has changed is that double clicking an ahk file no longer runs it, but opens it in Scite4AHK, and I have no ahk 'entries' in my context menu.

So grateful for your time.

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.25

Post by TheArkive » 21 Sep 2022, 11:08

DaveT1 wrote:
21 Sep 2022, 04:26
2) Do you happen to have admin permissions on your account? You shouldn't need it,, but it depends on how you use ahk and what you are trying to do.
Yes I do. Using install in AHK PI requires you to be administrator. And this works fine as long as I remember to launch your script as admin.

Just a minor correction. Admin privileges are actually not required, unless you select to install the registry keys into HKEY_LOCAL_MACHINE. The default is HKEY_CURRENT_USER and this requires no admin permissions. Having said that, it's good that you have admin rights, simply because AHK is more flexible with admin rights.

DaveT1 wrote:
21 Sep 2022, 04:26
Lastly, aside from context menu entries, are you able to use the ahk extension normally?
Really sorry, but I'm not sure what you mean. I can open ahk files in vscode (my prefered IDE) and run and debug in there. But the vscode extensions I use explicitely point to locations on my c drive that have the ahk executables. What has changed is that double clicking an ahk file no longer runs it, but opens it in Scite4AHK, and I have no ahk 'entries' in my context menu.

You answer actually answers my question ;) The fact you can't run ahk scripts with a double click indicates the entire ahk association is definitely broken, thus no context menus as well.

Regarding install / uninstall for AHK Portable Installer...

The Install button simply writes registry entries. The Uninstall button, removes them. AHK PI "management" functions don't use the registry at all. All settings are saved locally so one doesn't "install" or "uninstall" AHK PI. This script is only a manager to apply/remove the .ahk extension to/from the system. I hope that makes sense. AHK PI is basically self contained.

So, you should not need to scour the registry manually anyways. Try the following steps first.

  1. Click the Uninstall button in AHK PI. This will only remove all the registry data related to AHK and Ahk2Exe.
  2. Restart your computer.
  3. Click the Install button in AHK PI. This will re apply the registry settings. Don't forget to set your desired text editor for use with the context menus to edit scripts.

Side note...

If the above steps don't work, then here are the registry keys to check:
  • HKEY_CURRENT_USER\SOFTWARE\AutoHotkey
  • HKEY_CURRENT_USER\SOFTWARE\Classes\AutoHotkeyScript
  • HKEY_CURRENT_USER\SOFTWARE\Classes\.ahk
If you are using default settings then everything should be in the HKEY_CURRENT_USER hive. Otherwise look in the HKEY_LOCAL_MACHINE hive (same paths, different root).

If any of these keys are still remaining after you have clicked uninstall, then something is fishy.

Please let me know what result you get.

lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: AHK Portable Installer v1.25

Post by lexikos » 22 Sep 2022, 20:17

@DaveT1 has likely encountered a Windows bug that is triggered by the OpenWithProgID registration used in the SciTE4AutoHotkey 3.1.0 release. I've posted some information about it here: viewtopic.php?f=61&t=108745

User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: AHK Portable Installer v1.25

Post by TheArkive » 22 Sep 2022, 23:10

Thanks @lexikos. That is good to know. I thought there must have been something else going on.

Post Reply

Return to “Scripts and Functions (v1)”