AHK Portable Installer v1.29

Post your working scripts, libraries and tools for AHK v1.1 and older
DaveT1
Posts: 218
Joined: 07 Oct 2014, 11:23

Re: AHK Portable Installer v1.20

Post by DaveT1 » 17 Sep 2021, 12:36

Thanks man, appreciate the kind and understanding words - always feel I waste the time of you ahk gurus by asking dumb Qs and doing dumb things - appreciate it :-).

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 17 Sep 2021, 14:05

DaveT1 wrote:
17 Sep 2021, 12:36
Thanks man, appreciate the kind and understanding words - always feel I waste the time of you ahk gurus by asking dumb Qs and doing dumb things - appreciate it :-).
LOL ... if you were the only to have ever done something "dumb" then I might agree, but you are definitely NOT the only one to have "learned by making mistakes".

That is (one of) the way(s) of the computer geek.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 17 Oct 2021, 15:27

Right, I'm back :headwall: . Part of the process which allowed me to solve my own goof on file associations, was to completely remove ahk-pi-master. So I've tried putting it all back and I can't get anything to work :( . My ahk-pi-master folder structure looks like:
image.png
image.png (5.32 KiB) Viewed 3510 times

I believe I've followed the setup instructions carefully to populate each of the version folders and to make the AHK Portable Installer.exe. When I run this exeI get the follwoing message:
image.png
image.png (10.59 KiB) Viewed 3510 times
And when I say Try to Continue I get:
image.png
image.png (18.37 KiB) Viewed 3510 times
and clicking on OK gives me:
.....

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 17 Oct 2021, 15:29

image.png
image.png (8.51 KiB) Viewed 3509 times
So I'm not sure what I've got wrong!!??!! (I crtainly had stuff populated in the LV on my first attempt.

Again, sorry to ping you on this, but very grateful if you can put me on the right tracks.

Cheers, Dave.

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 17 Oct 2021, 23:32

@DaveT1

I need to know this info:
  • Are you setting this up on the same system or a different system?
  • Are you trying to install the ahk file associations? Or are you running in "Fully Portable Mode" this time?
  • In what location (directory) did you put ahk-pi-master?
  • Also, are you using AHK beta.1 or beta.2 for the EXE?
  • Is there anything preventing you from right-clicking on the EXE and selecting "Run as Administrator"?
The fact that you got "access denied" means you put it in a location you can't write to, that isn't going to work well.

I'll try to induce some errors to replicate what you have found. In the meantime answer my questions above and we'll see if we can get you up and running again.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 18 Oct 2021, 03:21

Thanks so much for getting back to me :thumbup:
Are you setting this up on the same system or a different system?
Same system - Windows 10 Pro, X-64. My personal laptop.

Are you trying to install the ahk file associations? Or are you running in "Fully Portable Mode" this time?
I'm trying to use it in the "Installer Mode" and want to use the #REQUIRES directive in each script.

In what location (directory) did you put ahk-pi-master?
Ah, this might be a possible issue - I've currently got it in "C:\Program Files\ahk-pi-master"!!

Also, are you using AHK beta.1 or beta.2 for the EXE?
beta.2

Is there anything preventing you from right-clicking on the EXE and selecting "Run as Administrator"?
Err, nothing other than not knowing this was a thing :facepalm:. Just tried it now and no longer get the access denied message, nor get this subsequent popup:
image.png
image.png (18.28 KiB) Viewed 3449 times
The fact that you got "access denied" means you put it in a location you can't write to, that isn't going to work well.
:facepalm: Right so I moved it off C: where I seem to need to be an administrator to do anything, and put it on D:. I then right click on "AHK Portable Installer.exe", run as administrator and, with no other pop-up / warning etc., get to here:
image.png
image.png (22.97 KiB) Viewed 3449 times
So that feels better!? But still nothing in the top LV and a warning about version mis-match :(


Hope that's all useful to getting this noob up and running? Really appreciate the help.

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 18 Oct 2021, 03:29

If you moved the ahk-pi-master folder to a location that doesn't need admin privileges you don't need to right-click > Run as admin.

Did you specify a folder for the base folder in the Basics tab?

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 18 Oct 2021, 03:30

Also, there have been some issues found with beta.2 ... ya might want to stick with beta.1 ... i haven't had a chance to thoroughly test beta.2 yet.

EDIT: ,.. meaning, the exe used to launch the script, you may want to replace that one with a beta.1 EXE.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 18 Oct 2021, 03:50

TheArkive wrote:
18 Oct 2021, 03:30
Also, there have been some issues found with beta.2 ... ya might want to stick with beta.1 ... i haven't had a chance to thoroughly test beta.2 yet.

EDIT: ,.. meaning, the exe used to launch the script, you may want to replace that one with a beta.1 EXE.

Right, I'll give that a go a bit later today and report back - thanks for the amazing (near real-time) help :clap:

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 18 Oct 2021, 03:51

What does your Basics tab look like?

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 18 Oct 2021, 04:02

image.png
image.png (17.82 KiB) Viewed 3423 times
(as a minor aside I was expecting the "X" to the right of the Text Editor box to delete whatever text editor was currently showing. But clicking the "X" doesn't seem to do anything?)

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 18 Oct 2021, 04:07

The x puts the default back to notepad.exe which would have no effect on whether the main LV populates downloaded/chosen versions.

So... In your script dir for ahk-pi, there should be a versions folder with your chosen versions of AHK. Or, that folder should be empty if its a fresh copy of ahk-pi. Do you have anything in the versions folder like one of your previous screenshots suggest?

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 18 Oct 2021, 08:46

The x puts the default back to notepad.exe which would have no effect on whether the main LV populates downloaded/chosen versions.
Brilliant - thanks for explaining that :thumbup:

So... In your script dir for ahk-pi, there should be a versions folder with your chosen versions of AHK. Or, that folder should be empty if its a fresh copy of ahk-pi. Do you have anything in the versions folder like one of your previous screenshots suggest?
I did a complete fresh install, so initially there was no versions folder. So then created a versions folder and populated it:
image.png
image.png (115.41 KiB) Viewed 3386 times
And I think that I followed your instructions for v2 folder setup - though am now surprised there are files in the v2 Compiled other than Ahk2Exe.exe!

I still need to try reverting to v2 beta.1 though. I should be able to get to that later today.

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 18 Oct 2021, 08:59

Wait a minute. Your 2 folders of AHK in the versions folder have no variation of AutoHotkey.exe?

At a minimum:

AHK v1 folder should have:
  • AutoHotkeyA32.exe
  • AutoHotkeyU32.exe
  • AutoHotkeyU64.exe
AHK v2 folder should have:
  • AutoHotkey32.exe
  • AutoHotkey64.exe
If you don't have any of these EXE files, then it's no wonder the main LV is not populating. It needs those EXE files in the proper folders to function. This is the foundation for how 2 different versions of AHK can run on the same system at the same time (when the #Requires directive is properly used in scripts - see the GitHub docs for how ahk-pi parses the #Requires directive).

More questions:
  • How did you manage to not have those EXE files available in the folders?
    - I ask because if you downloaded the zip files manually or through the GUI, those EXEs are there.
  • Did you download the zip files manually?
  • Did you download through the Downloads tab in the ahk-pi GUI?
  • Are you running some kind of antivirus or antimalware program?
    - It is possible a false positive was detected and the EXE files have been quarantined by your anti-whatever program.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 19 Oct 2021, 05:06

Right, time for (another :facepalm: ) mea culpa....seems like I didn't realise that "Now you can download AutoHotkey through the UI. Just click Settings, pick a major version from the DropDownList, then select/downlad your desired version(s)." meant that ahk-pi-master would download and install whichever selected version into the ahk-pi-master\...\versions base folder :facepalm: . I'd been trying (and mostly failing) to build these version folders manually :facepalm: .

So,with that 'cluster*&^%' all cleared up - much kudos to TheArkive :bravo: , I now seem to be in a fully working condition :D :D :D.

But, if you're still in anyway motivated to still help this utter noob, then, for a simple script like

Code: Select all

;~ #Requires AutoHotkey 2.0-beta.2
;~ MsgBox "Current version of AHK = " A_AhkPath " \ " A_AhkVersion

#Requires AutoHotkey 1.1.33
MsgBox, Current version of AHK = %A_AhkPath%\%A_AhkVersion%
Toggeling between these two work like a charm when I double click the script filename in Explorer.

But when I try to run and/or debug this little script in my chosen editor (eg., SciTE4AutoHotkey or VS Code), the message boxes both say that "C:\Program Files\AutoHotkey\AutoHotkey.exe" is being used, or, if the code comments are toggled the other way, give a warning that there is no v2 to use. So I'm guessing that internally these editors will have settings that point the editor to the original AHK installation directory and not to ahk-pi-master\...\versions.

So, assuming I can find these settings / they're exposed to the user, then hopefully I can manually edit these to point the editor to the required ahk-pi-master\...\versions, thereby allowing the editors to use my choosen version. Do that sound like the right thing to do? If this is possible, then it does suffer the problem of manually changing the settings in the editor!!

Thanks for all the help and very sorry for going a long way down the wrong rabbit hole!

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 19 Oct 2021, 06:55

DaveT1 wrote:
19 Oct 2021, 05:06
I now seem to be in a fully working condition :D :D :D.

Well that's a relief! I'm still interested to find out how you manged to not have the EXEs in those sub-folders. I actually don't use the "download feature" that I created, because I do place my versions in a separate folder location, manually, but I don't omit the EXEs of course. I only added the download feature because I could, and it helped to lower the bar for over-all complexity of using the program. So, manually "curating" your collection of AHK versions to use on your system is not the issue (technically).

DaveT1 wrote:
19 Oct 2021, 05:06
But, if you're still in anyway motivated to still help this utter noob, then, for a simple script like

Code: Select all

;~ #Requires AutoHotkey 2.0-beta.2
;~ MsgBox "Current version of AHK = " A_AhkPath " \ " A_AhkVersion

#Requires AutoHotkey 1.1.33
MsgBox, Current version of AHK = %A_AhkPath%\%A_AhkVersion%

Right off the bat, having 2 #Requires directives in one script (even if one is commented) is probably part of the problem. Even a commented out #Requires directive is parsed because most older versions of AHK don't support it. So I coded ahk-pi to parse even commented out #Requires directives. Although the way you crafted ;~... should mitigate this issue.

It is also important to point out that AFTER ahk-pi decides which EXE to use, the #Requires directive is used by AHK itself. The version of EXE that executes the script must be >= the version specified in the #Requires directive. So you need to be sure of what versions of AHK are in your versions folder.



Your usage of the #Requires directive is strict, and requires beta.2, therefore any other AHK v2 beta will not suffice. Did you in fact put beta.2 EXEs in the versions folder?

You would be better off with something like one of the top 2 examples below that are less restrictive:

Code: Select all

#Requires AutoHotkey 2.0- ; <--- this uses the latest ahk v2 beta found
#Requires AutoHotkey 2.0-beta ; <--- this is the same as above

#Requires AutoHotkey 1.1 ; <--- uses the latest AHK v1.1 found, not limited to 1.1.33

#Requires AutoHotkey 2 ; <--- this uses a release of ahk v2 that does not yet exist, a legit non-beta release
#Requires AutoHotkey 2.1 ; <--- this is the same as above, but requires non-beta v2.1 - which doesn't yet exist

DaveT1 wrote:
19 Oct 2021, 05:06
So I'm guessing that internally these editors will have settings that point the editor to the original AHK installation directory and not to ahk-pi-master\...\versions.

The text editors do not "select" which version of AHK si used. This is done by the file type associations for the .ahk extension. You apply this extension to the system by selecting/installing/double-clicking on an item from the main list in ahk-pi. My program (ahk-pi) actually selects which EXE to use. If no #Requires directive is found, then the "default" version installed is used. If a #Requires directive is found then it attempts to find that latest version that matches the #Requires criteria. If the criteria is strict and requires a specific version, then that version is searched. If found, it is executed, if not you get an error message.

As for the "Autohotkey.exe is in use" error message, that is odd. AutoHotkey can be run in multiple instances of itself. Usually if a script is already running, it will tell you so, and ask if you want to replace the existing instance with a new instance. Post the error messages after trying some of what I've suggested above.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 19 Oct 2021, 14:42

Well that's a relief! I'm still interested to find out how you manged to not have the EXEs in those sub-folders. I actually don't use the "download feature" that I created, because I do place my versions in a separate folder location, manually, but I don't omit the EXEs of course. I only added the download feature because I could, and it helped to lower the bar for over-all complexity of using the program. So, manually "curating" your collection of AHK versions to use on your system is not the issue (technically).
Only got there because of your patience :bravo:! However, now that I know how to use the ahk-pi Download facility, I immediately scrubbed all the manually created version folders and relied on ahk-pi to keep these done right. So I can't now to recall what I did! Whatever it was, it was nothing less that a massive brain-fart. Oh, and I'm so pleased you added the Download facility. Manually curating is clearly fine for those (of you) that know what you're doing ;) .
Right off the bat, having 2 #Requires directives in one script (even if one is commented) is probably part of the problem. Even a commented out #Requires directive is parsed because most older versions of AHK don't support it. So I coded ahk-pi to parse even commented out #Requires directives. Although the way you crafted ;~... should mitigate this issue.
OK, understood. It does seem that the SciTE4AutoHotkey block comment style (;~...) doesn't cause an issue for the ahk-pi parser, but I get your general comment about not having more than one #Requires directive.
It is also important to point out that AFTER ahk-pi decides which EXE to use, the #Requires directive is used by AHK itself. The version of EXE that executes the script must be >= the version specified in the #Requires directive. So you need to be sure of what versions of AHK are in your versions folder.
Right, that's a great point. But now that I exclusively only use the ahk-pi Download button, I think all the right .exe files for each AHK version should be present and correct?
Your usage of the #Requires directive is strict, and requires beta.2, therefore any other AHK v2 beta will not suffice. Did you in fact put beta.2 EXEs in the versions folder?
...You would be better off with something like one of the top 2 examples below that are less restrictive:
Understood about being too strict - thanks for pointing that out. I've changed my little 'version' script accordingly.
As for the "Autohotkey.exe is in use" error message, that is odd. AutoHotkey can be run in multiple instances of itself. Usually if a script is already running, it will tell you so, and ask if you want to replace the existing instance with a new instance. Post the error messages after trying some of what I've suggested above.
Ah, I may have worded this badly and left it open to interpretation. I was intending to show the folder location of the .exe that was being used. Consider, for example, a script with the follwoing code:

Code: Select all

#Requires AutoHotkey 1.1
MsgBox, Current version of AHK = %A_AhkPath%\%A_AhkVersion%
If I use explorer to double click (run) the script I get this (ie., clearly using a version from ahk-pi):
image.png
image.png (4.15 KiB) Viewed 3318 times
But if I run the file from within SciTE4AutoHotkey, I get this (ie., this uses a version from the 'normal' AHK install):
image.png
image.png (3.2 KiB) Viewed 3318 times

That why I thought those editors with a Run and/or Debug facility, must point that editor to which .exe to use? I spent some time digging through all the various files with SciTE4AutoHotkey. It seems that the _platform.properties file has the following:

Code: Select all

Compiler=$(AutoHotkeyDir)\Compiler\Ahk2Exe.exe
AutoHotkey=$(AutoHotkeyDir)\AutoHotkey.exe
and I imagine that if I kept looking I'd find that AutoHotkeyDir would be set to C:\Program Files\AutoHotkey - ie., the AHK normal install directory. So If I could find where this path is set, then I could set it to be the path of whichever version of ahk I wanted to use from within ..\ahk-pi-master\versions\..? Doing this would, I think change the path reported when I run the script from within SciTE4AutoHotkey. Does that all seem plausible?

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 19 Oct 2021, 14:46

Ok .. didn't read your full reply yet but if you are using SciTE, then it may have it's own method of actually choosing an EXE to run a script, and I don't know what that framework is, or how/if it meshes with my ah-pi script.

EDIT: Specifically, if you are using SciTE to actually launch the script ...

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

Re: AHK Portable Installer v1.20

Post by TheArkive » 19 Oct 2021, 14:51

Ok, so you would need to configure something in SciTE then, I'll need to research what that is exactly. Shouldn't be too hard. I'll post again once i find the right way to do this.

Worst case scenario, it might not be possible to take advantage of some of what ahk-pi offers when using SciTE. But I think I should be able to work with SciTE on this issue, since my ahk-pi script actually decides what exe to run. We just have to put in the proper command line to use in order to run the script with ahk-pi, then the #Requires directive will do the rest.

EDIT:

In regards to running the scripts by double-click or shortcut, that should not be an issue. Let me know if it is.

EDIT:

Just setup SciTE4AHK and tried running a simple script on my system, it didn't work. I'll have to mess with it to figure out how to get it to work.

EDIT:

If you like, I can help you setup Notepad++. That's what I use, and there is a plugin to press SHIFT+F5 to run a currently running script (it uses the system file associations). You can of course also setup syntax highlighting as well. There are some limited call tips available, but mostly for Ahk v1.

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

Re: AHK Portable Installer v1.20

Post by DaveT1 » 20 Oct 2021, 03:16

Man, you are truely the most helpful person! Where's the 'buy you a beer' button?!
In regards to running the scripts by double-click or shortcut, that should not be an issue. Let me know if it is.
Thus far, this aspect is working like a charm. I'll obviously keep an eye on it, fully anticipating that any issues will be on this side of my keyboard!
Just setup SciTE4AHK and tried running a simple script on my system, it didn't work. I'll have to mess with it to figure out how to get it to work.
EDIT:
If you like, I can help you setup Notepad++. That's what I use, and there is a plugin to press SHIFT+F5 to run a currently running script (it uses the system file associations). You can of course also setup syntax highlighting as well. There are some limited call tips available, but mostly for Ahk v1.
I tend to use SciTE4AHK for quick scripts - it was the editor that I started with. But I'm trying to transition to VS Code in an effort to (a) use a tool that has a wider user-base and active development, and (b) it has version control built in (and I'm trying to learn to do the right thing and use this)!
I use the AutoHotkey Plus Plus VS Code extension, which has, as part of its settings, this:
image.png
image.png (29.93 KiB) Viewed 3249 times
...and this is where I imagine that if I manually change the Compile, Execute and Help paths to locations in ahk-pi\...\versions, I can change the version that VS Code uses for running and debugging (accepting that I'd have to manually swap back and forth as necessary?

Post Reply

Return to “Scripts and Functions (v1)”