AHK Portable Installer v1.29

Post your working scripts, libraries and tools for AHK v1.1 and older
lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: AHK Portable Installer v1.18

Post by lexikos » 09 Jul 2021, 19:31

Do you have any requirements for downloading AHK zips direct through the script?
I'm not sure what you mean. I haven't used the script yet and probably won't; just started looking into it to see how it compares to my own ideas for the installer. If you're asking me as a website admin, I don't have any requirements other than to use common sense. I suppose you can scrape the download index pages or use the GitHub API to list releases.

For the installer, I hadn't really put much thought into it yet. I'd probably just have download options for the latest from each major version, Ahk2Exe, and maybe eventually other tools or scripts to set up editors.

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

Re: AHK Portable Installer v1.18

Post by TheArkive » 09 Jul 2021, 23:40

lexikos wrote:
09 Jul 2021, 19:31
If you're asking me as a website admin, I don't have any requirements other than to use common sense.
That is exactly what i meant. Thanks 😊

For the time being I'm scraping the site.

Even though ya won't be using it i plan to incorporate the ideas you mentioned as well for downloading Ahk2Exe and such. The main difference is my installer lists the entire index for a specified major version.

I'm taking the route of making all the versions readily available for user selection.

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

Re: AHK Portable Installer v1.18

Post by TheArkive » 10 Jul 2021, 17:02

WARNING!!!!!
This is a major update! You will have to replace your settings.json file, but no need to reconfigure regex. Now this script uses the #REQUIRES directive to select an exe. Read the docs on GitHub, a lot has changed with dynamic script launching.


1.19
  • AHK Launcher has been replaced by usage of the #REQUIRES directive (thanks to @vvhitevvizard and @lexikos for inspiration).
  • Downloading is now possible through the UI.
  • The default Base Folder is now the script directory.
  • Uses #Requires directive to select exe for script launch, no more AHK Launcher.
  • Installs to HKCU by default. Can be changed to HKLM in Settings > Basics tab.
  • Minor bug fixes, and small adjustments.
  • Reworked some code to be less redundant.

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

Re: AHK Portable Installer v1.19

Post by TheArkive » 11 Jul 2021, 02:46

Quick fix:

The error messages when just hovering the mouse over the window are fixed. Sorry for the goof.

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

Re: AHK Portable Installer v1.19

Post by TheArkive » 11 Jul 2021, 09:08

Fixed the Latest button to display/hide latest versions on click as intended.

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

Re: AHK Portable Installer v1.19

Post by TheArkive » 11 Jul 2021, 10:34

...Also fixed the downloading (partially broke? completely broke?)

Did several tests, downloads happen as expected, and hash checking is working nicely.

EDIT: and fixed parsing of #Requires string without bitness option, ie -> #Requires AutoHotkey v2.0- ; 64-bit

specifying the bitness should of course be optional.

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

Re: AHK Portable Installer v1.19

Post by TheArkive » 12 Jul 2021, 14:01

FIxed issue with file verification:
* changed flag on CryptAcquireContext to 0xF0000000
* remvoed "throw" when unable to delete version dir on user request, it should just be a msgbox prompting the user to end/terminate the executable and try removing again
Last edited by TheArkive on 13 Jul 2021, 08:04, edited 1 time in total.

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 13 Jul 2021, 08:03

v1.20
  • Removed some redundant code.
  • Improved handling of settings.json - there is no more `settings.json.blank` - the script will create the file with all default settings.
  • Improved handling of errors and related error messages.
  • Added a "ReadOnly" mode for when being invoked by command line/registry. Now settings are only written to disk when closing the GUI.
  • Fixed listing of AHK_H EXEs (was temp broken).
  • Removed lots of comment code.
  • Updated docs.

Sorry for all the bugs. I needed more time to come across some weird circumstances that threw errors. v1.20 should be much more stable. You likely won't be able to keep your old settings file, but really, now there isn't much to configure so it shouldn't matter so much.

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK Portable Installer v1.20

Post by LBJ » 31 Jul 2021, 05:04

G'day TheArkive,

Thanks for your efforts on this project.

From your current v1.20 release, in the SetActiveVersionGui() function, you have the following code...

Code: Select all

        regVer := InstProd " " ver
        ActiveVersion := (Settings.Has("ActiveVersionDisp")) ? Settings["ActiveVersionDisp"] : ""
        
        oCtl := oGui["ActiveVersionDisp"]
        If (regVer = "")
            oCtl.Text := "AutoHotkey not installed!"
That test for regVer against an empty string will never be true.

It can only match against " " (a space) due to the preceding regVer concatenation assignment which includes a space.

Best regards,

LBJ

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 31 Jul 2021, 05:49

Good catch @LBJ. Thanks for the assist.

I'll definitely take a look at that. And thanks for the feedback :)

EDIT:

* Fixed.

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK Portable Installer v1.20

Post by LBJ » 01 Aug 2021, 05:07

G'day TheArkive,

We still have quite a few legacy applications written for Classic 1.0 AHK which we only bother updating when we need to make mods, so I just added a small patch to your v1.20 release in our installation to allow for #Requires handling for 1.0 versions. I added the following in your funcs.ahk file within the GetAhkProps(sInput) function...

Code: Select all

    ahkProduct := arr[1], bitness := StrReplace(arr[arr.Length],"-bit","")
    ;gcs add begins
    if (SubStr(ahkVersion, 1, 4) = '1, 0') {
        ahkVersion := StrReplace(ahkVersion, ', ', '.')
        bitness := 32
    }
    ;gcs add ends

That's possibly not very useful to most users though. However, more importantly, in testing your release version with various #Requires directives, I noticed you handle the case of a non satisfied version requirement as though a version was returned and the AutoHotkey*.exe file doesn't exist...

Code: Select all

    If obj.err {
        Msgbox obj.err
        ExitApp
    } Else If !FileExist(obj.exe) {
        msg := "The following EXE cannot be found:`r`n`r`n"
             . obj.exe "`r`n`r`n"
             . "Did you recently move or rename some folders?"
        Msgbox(msg,"File not found",0x10)
        ExitApp

The problem is that when an empty obj.exe is returned (because no valid AutoHotkey*.exe can be found), obj.exe will be empty. That will also satisfy your !FileExist(obj.exe) test and then a confusing MsgBox will be produced with a message along the lines of...

Code: Select all

The following EXE cannot be found:
              ""
Did you recently move or rename some folders?

If you add an earlier specific test for an empty obj.exe, you could then raise a MsgBox with a more meaningful message, perhaps displaying the #Requires directive which could not be satisfied, such as...

Code: Select all

No suitable EXE coud be found for:

#Requires AutoHotkey 2.2 ; 64-bit

Did you make a typo or rename some folders?

Again, thank you very much for the time you've invested in providing this very useful utility to the AHK community. The new addition of update checking and installing is a real time saver.

Best regards,

LBJ

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 01 Aug 2021, 05:13

Ah, so all of this mostly stems from AHK v1.0 version data using ", " as a separator instead of "." as a separator in version data?

If your patch works for your needs then that is actually very useful, just to expand compatibility.

Please let me know if I got that understanding correct.

EDIT:

Ok now I see the 2nd part you were getting at. Thanks again! That'll be easy to fix.

Glad this is working out for you guys :) and thanks for the help. I would not have come across these scenarios.

EDIT2:

@LBJ - fixes pushed - updating OP now

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK Portable Installer v1.20

Post by LBJ » 01 Aug 2021, 06:01

G'day TheArkive,

Yes, we work primarily with 1.2, but now we can still easily maintain and run our 1.1 and 1.0 projects with that small patch to your code. We now have 1.2 as our installed version via your application, and 1.0 and 1.1 scripts are also handled correctly with the #Requires directive method. For 1.0, with the final 1.0.48.05 installation, we just bulk added to all our 1.0 scripts...

Code: Select all

; #Requires AutoHotkey 1.0 ; 32-bit

The odd MsgBox reporting to the user is something I guessed you'd never notice unless you actually had a #Requires directive requiring a version you didn't have installed. I obviously noticed it when I tried to run a 1.0 script and then found the problem with the odd comma notation of the 1.0 version.

I've installed your updated version from just now, but it doesn't successfully run our 1.0 scripts which did run as expected with my own patch. Now when we try to run a 1.0 script, your MsgBox comes up advising that "the following #REQUIRES directive could not find a match - ; #Requires AutoHotkey 1.0 ; 32-bit"

I'll do a debug and get back to you in a bit.

Best regards,

LBJ

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 01 Aug 2021, 06:06

@LBJ

I think i found it. I had the logic reversed with the line I added to set the proper bitness:

Code: Select all

; orig was
bitness := (SubStr(ahkVersion,1,3) = "1.0") ? StrReplace(arr[arr.Length],"-bit","") : 32

; should be
bitness := (SubStr(ahkVersion,1,3) = "1.0") ? 32 : StrReplace(arr[arr.Length],"-bit","")
Pushing code now.

LBJ
Posts: 19
Joined: 10 Aug 2020, 04:22

Re: AHK Portable Installer v1.20

Post by LBJ » 01 Aug 2021, 06:18

G'day TheArkive,

That's what I was going to say...

Code: Select all

bitness := (SubStr(ahkVersion,1,3) = "1.0") ? 32 : StrReplace(arr[arr.Length],"-bit","")

Thanks for including this in the release itself. It saves us from patching each time we update your application.

I manually patched your code at our end and it's perfect, so I suspect your new release will also be correct.

I'll leave a post if it's not, but I very much doubt it.

Have a good one.

Best regards,

LBJ

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 01 Aug 2021, 06:23

No problem man. Being able to recognize and run AHK v1.0 binaries falls right in line with what I had intended with this script, so it's a win-win :)

Thanks again for the help and feedback.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 15 Sep 2021, 15:34

Hi @TheArkive , many thanks for this application. Together with your well document git-hub, made it real easy for a newbi to follow :D .

That is, while i had it all working this afternoon, I've come back after a laptop re-start and I can't make any version of ahk connect with an .ahk file through your app! There are no contect menu add-ins (run,...etc), no icon for the file. Could it be something in the registry has gone wrong?

I guess I'm gonna have to strip this app out, uninstall all versions of ahk and the start by installing latest 1.1 and see if that works. Does that sound the right thing to do in the first instance? I could then re-try working with your app?

Recognising that whatever my problem is it's pretty vaguely described, but thanks for any pointers.

Update: I ran the official 1.1 installer. This added no ahk context menu options. I then deleted all folder and files assciated with AHK Portable Installer and restarted the laptop. No context menu items. Re-ran the official 1.1 installer and still no ahk context menu items. :?

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 15 Sep 2021, 16:44

@DaveT1

This sounds like one heck of a puzzle.

Do you run anti-virus? Some AV may detect AHK as a "potentially unwanted app" and can then quarantine it.

Are you on a personal laptop or a work laptop?

Have you restarted before without issue? Or is this the first install/restart?

The fact that the legit installer isnt working points to some other issue. The legit installer should overwrite all my app settings in the registry.

EDIT: do you have any weird scripts/cleaners/tuneup programs running?

EDIT2: Did you enable fully portable mode, or no?
DaveT1 wrote: Could it be something in the registry has gone wrong?
It sounds very much like something in the registry is wrong. But it also sounds like something else may be tampering with the registry. Something that doesn't like AHK for some reason.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 16 Sep 2021, 02:38

Hi @TheArkive, thanks so much for getting back......
TheArkive wrote:
15 Sep 2021, 16:44
Do you run anti-virus? Some AV may detect AHK as a "potentially unwanted app" and can then quarantine it.
yes, I have MS shipped protection. AHK 1.1 has run for 2+ years on this laptop with no problems.
Are you on a personal laptop or a work laptop?
Have you restarted before without issue? Or is this the first install/restart?
Personal laptop. Owned 2+ years, with multiple restarts that caused no problem with AHK 1.1.
The fact that the legit installer isnt working points to some other issue. The legit installer should overwrite all my app settings in the registry.
That's what I thought, so imagine my horror when this didn't work. Now completely lost understanding what next things to look at.
EDIT: do you have any weird scripts/cleaners/tuneup programs running?
No - at least not to my knowledge!
EDIT2: Did you enable fully portable mode, or no?
Left it as fully portable.
DaveT1 wrote: Could it be something in the registry has gone wrong?
It sounds very much like something in the registry is wrong. But it also sounds like something else may be tampering with the registry. Something that doesn't like AHK for some reason.
#runsscreammingintotheseanevertobeseenagain ;)


BUT - I think I fixed it :superhappy: (got most of the way through replying above, so have left those in case useful to others). Something you said above prompted me to check the file associations and it seemed these got bummed - which I think might have been me :facepalm:. I'd ended up with .ahk being associated with VSCode! Once I changed the file association back to autohotkey unicode 32-bit, double-clicking the ahk file ran it as expected, and ahk context menu items returned.

I'll go through and re-implement your app later today. Then I just have to understand how to make the ahk VSCode extensions I use work between ahk 1.1 and ahk 2!

Thanks so much for your willingness to help :bravo: , and sorry to have wasted your time.

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 16 Sep 2021, 04:19

Heh, you are good man, you didn't waste my time. I feel like I understand your frustration.

Just to be clear about my app, the default install mode is what I call "semi portable". The fact that it writes registry entries and establishes file associations makes it not portable (technically).

"Fully Portable" mode means no registry entries are written.

So, glad you got the file associations worked out. That is indeed one of the core functions of my app.

Post Reply

Return to “Scripts and Functions (v1)”