AHK Portable Installer v1.16 (now fully portable)

Post your working scripts, libraries and tools
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.8

Post by TheArkive » 29 Jun 2020, 10:09

vvhitevvizard wrote:
29 Jun 2020, 09:59
In other words, ur tool requires a user to re-edit scripts. I'm talking of ur script to analyze a script to be run a bit deeper: u might even start parsing some commands to get an idea whether it requires AHK v2 or v1.
That's not the point of this script.
User avatar
vvhitevvizard
Posts: 436
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: AHK Portable Installer v1.8

Post by vvhitevvizard » 29 Jun 2020, 10:09

U could use all the methods together. Search for commented first line keywords, search for #requires,
and just to give u a glimpse of my idea, searching with this regex "s):=gui\.new\(" would ensure u r having a deal with exactly AHK v2-112+ script.
TheArkive wrote:
29 Jun 2020, 10:05
@vvhitevvizard
I think you may be confused about how this script functions.
To be honest I didn't run ur scripts yet. I got ur script function idea by reading this
AHK Launcher. This lets you run multiple versions of AHK side-by-side. Just modify your scripts as follows:
- insert ; AHK v# as line 1 in your script
- specify the exact match or regex match in the Extras tab
- specify an EXE to run the script for each match entry
And it came into my head "it might be a hassle of having all the other ppl scripts I was about to test to be rdy for this feature". On the other hand, what stops us from starting to analyze scripts to run more deeply? :) I, for one, had had some issues recently switching between v2-103, v2-108, v2-112 script versions trying to convert them, fall back, etc. Slightly different AHK interpreter version and scripts fail to run... And due to human factor nature, at some point I messed up with labels indicating required AHK versions inside my scripts.
Last edited by vvhitevvizard on 29 Jun 2020, 10:30, edited 3 times in total.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.8

Post by TheArkive » 29 Jun 2020, 10:20

:headwall: :headwall: :headwall: :headwall: :headwall: :headwall:
Dude, I appreciate your feedback, but again, I think you are missing the point of this script/program. Your proposed solution is actually more complex and restrictive than what my script does. Have you tried this script yet? If you do, please run it compiled. I won't support issues with this program as a script.
User avatar
vvhitevvizard
Posts: 436
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: AHK Portable Installer v1.8

Post by vvhitevvizard » 29 Jun 2020, 10:26

Sorry for distraction. I proposed side notes. Not concerning ur designated fixed idea.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.8

Post by TheArkive » 29 Jun 2020, 10:41

@vvhitevvizard
No problem. A little background on this script:

At any given time I have 8+ active versions of AHK available to the system. I tell the program what "first-line comment" to expect. On match, the specified match triggers an associated EXE. All of this is configurable in the GUI. It can be as broad or specific as the user wants. The number of versions the user can add is only limited by system memory, and hard drive space. If i wanted to specify a specific sub-version of AHK i could, in this first line comment, though that isn't something I would normally do in my case.

I'm not trying to "guess" what version a script is. And if a user implements #requires, again, it won't affect how this script works. To me, adding such a first line comment is trivial, given the payoff, that is I can run as many parallel versions of AHK as I want for testing, and the changes needed to be made for each script are very minor (just this first-line comment... that's all).

I actually have a planned update, since right now all regex matches are case sensitive. The next update will fix a few minor AHK v2 updates, and automatically add i) for regex matches for convenience.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.9

Post by TheArkive » 16 Oct 2020, 15:49

Updates 2020/10/16:
  • RegEx matches in EXE list (Extras Tab) are now case insensitive.
  • Added checkboxes for toggling the showing of context menu elements
  • Improved registry interaction, should properly function when "Run as Administrator" is selected.
  • If window was moved out of bounds of the "active monitor", now the previous coordinates will be overwritten to ensure the window is properly displayed in-bounds on the current monitor. This is most necessary when working on a multi-monitor setup, and then switching to a single monitor.
  • Scaled back "Ahk2Exe Handler". AutoHotkey_H v1 compiler behaves significantly different than expected and doesn't seem to integrate as well with the context menu. Currently using the "Ahk2Exe Handler" will simply open Ahk2Exe and auto-fill the script to be compiled.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.10

Post by TheArkive » 17 Oct 2020, 18:37

Update 2020/10/18
  • Rewrote registry handling to be as fast as it was in v1.8
  • Reorganized some GUI controls and labeled some things better.
  • Updated docs.
  • Updated OP with a more concise list of features.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.11

Post by TheArkive » 13 Jan 2021, 19:55

Update 2021/01/14
  • Script now can be run uncompiled.
  • You must use AHK v2 binaries to run the script if running uncompiled.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.11

Post by TheArkive » 20 Jan 2021, 04:14

On my last update, I misspoke.

If you copy over the AHK v2 binary and rename it to AHK Portable Installer.exe, then you can still choose any base install version you want, as long as you run the renamed EXE.

If you select a base install of AHK v1 and try to run this script directly, then of course it will not work. So... just run the copied EXE.

Sorry for the confusion. OP has been updated. Docs update coming shortly.

EDIT: Docs updated.
treflip
Posts: 3
Joined: 08 Jun 2015, 09:49

Re: AHK Portable Installer v1.11

Post by treflip » 04 Feb 2021, 17:14

Hello,

I too am having issues getting this to work on a computer I don't have admin privileges on. I have an old version of AHK that does run scripts but I can't get any newer version to run.

I don't see the program and assume when you wrote
(first option, first tab)
it meant the program was running? I can't get the program to run so maybe this is the first step to do for me?
I may not compile any more releases unless requested since AHK v2 works perfectly with AHK v1 compiler. Just make sure you save the .bin files in the AHK v2 compiler folder.
Is this suggesting getting the bin files from the v1 version? I don't believe I have this file anywhere.

I tried these steps:
  1. created this base folder: H:\Documents\AutoHotKey (h is remote server but mapped to h)
  2. put versions into this base folder
  3. downloaded the v2 alpha vers over and unzipped it into H:\Documents\AutoHotKey\AutoHotkey 2.0-a123-e5801ee8
    (was confused on this part since the documentation says to separate version and name with space but unzipped the folder has an underscore). Removed underscore and left space
    ie. H:\Documents\AutoHotKey\AutoHotkey 2.0-a123-e5801ee8
  4. unzipped the ahk-pi-master.zip into a folder and renamed it AHK Portable Installer (assumed main script meant the AHK Portable Installer.ahk and so did that)
  5. Step said
    If you are running this script uncompiled, grab the latest copy of AHK v2 alpha, copy the desired version of AutoHotkey.exe into the script dir and rename it to AHK Portable Installer.exe. Run this EXE file to launch the script.
    So I grabbed "H:\Documents\AutoHotKey\AutoHotkey 2.0-a123-e5801ee8\AutoHotkeyU32.exe" and moved it to the scriptfolder and renamed it. looks like this now: "H:\Documents\AutoHotKey\AHK Portable Installer\AHK Portable Installer.exe"
But when I open a cmd prompt and run "H:\Documents\AutoHotKey\AHK Portable Installer\AHK Portable Installer.exe" "H:\Documents\AutoHotKey\AHK Portable Installer\AHK Portable Installer.ahk", I get an access denied.

I also read this
If you run this as a script (not compiled), simply copy the latest AHK v2 binary to the script directory and rename it to AHK Portable Installer.exe. Then always run the script with this EXE. You can still set any AHK version as the base install for the system with the uncompiled script.
so also tried to copy the bin file over and renamed it to : "H:\Documents\AutoHotKey\AHK Portable Installer\AHK Portable Installer.exe" but that didn't work as well (access denied).

The closest I got to making it work was to use the old version of autohotkey.exe with the AHK Portable Installer.ahk but I get a

Code: Select all

---------------------------
AHK Portable Installer.ahk
---------------------------
Error:  Parameter #1 invalid.

Specifically: "Input"

	Line#
--->	002: SendMode,"Input"

The program will exit.
---------------------------
OK   
---------------------------
if I comment out that line I get another error. I may be going down the wrong path though and thought I ask for help!

Thanks for any input you can give. I appreciate it!

Update: 2/4/21
I was able to get to a computer with admin privileges and went to thenickmay link and saw that I could run with the U64 version. I copied that into the AHK Portable Installer folder and was able to the installer to pop up.

However when setting the base AHK folder to H:\Documents\AutoHotKey\AutoHotkey 2.0-a123-e5801ee8 and selecting either the 32 or 64 bit version and pressing activate I get an access denied prompt again. After 3 acks I see this error

Code: Select all

---------------------------
AHK Portable Installer.ahk
---------------------------
Error:  (5) Access is denied.

	Line#
	460: MsgBox(reg.reason "



" reg.cmd)
	461: if reg.add("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.ahk\ShellNew","FileName","Template.ahk")
	462: MsgBox(reg.reason "



" reg.cmd)
	465: if !FileExist(A_WinDir "\ShellNew")
	466: DirCreate(A_WinDir "\ShellNew")
	467: Try
	467: FileDelete(A_WinDir "\ShellNew\Template.ahk")
--->	468: FileAppend(templateText, A_WinDir "\ShellNew\Template.ahk")
	470: reg.delete("HKEY_LOCAL_MACHINE\Software\AutoHotkey")
	472: Sleep(350)
	475: root := "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\Shell" (Settings["CascadeMenu"] ? "\AutoHotkey\Shell" : "")
	476: if reg.add("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript","","AutoHotkey Script v" majorVer)
	477: MsgBox(reg.reason "



" reg.cmd)
	484: if reg.add("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoHotkeyScript\DefaultIcon","",Chr(34) exeFullPath Chr(34) ",1")
	485: MsgBox(reg.reason "



" reg.cmd)

Try to continue anyway?
---------------------------
Yes   No   
---------------------------



Tre
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.11

Post by TheArkive » 05 Feb 2021, 07:27

@treflip

Wow that's a lot of effort!

=========================================
EDIT: The fact you get this error suggests you may not have admin access, or you may need to restart and try again.
If you don't have access to read/write to the registry, I'm afraid you won't be able to use my script currently. I'll need to do more research to come up with more "Access Denied" cases and how to try to solve them. Here's some things to check:
  • Have you tried checking the UAC (User Account Control) settings? Open the start menu and type "user account control". You can modify the settings this way.
  • If you disable UAC settings, you MUST restart in order for the settings to take effect, or you will still get "Access Denied".
=========================================

We'll see what we can come up with here.

Basically, this script will require admin rights in order to make registry modifications, or to even look at the registry. You're the first user I've come across who has tried to run this without admin rights, so I'll see what I can do to modify this script.

Until then, my next post will list some alternative options for you to be able to run other versions of autohotkey. I posted in a thread a while ago where at least 2 or 3 other users also posted their solutions as well. I'll find it and post here.

To try and get you going faster, try this:

Code: Select all

If you have a script called "MyScript.ahk", simply copy and rename the AutoHotkey.exe
file to the same name as the script with the .exe extension.  So..

MyScript.ahk <-- your script
MyScript.exe <== AutoHotkey.exe renamed

Then simply run MyScript.exe after you finish making edits to your ahk script file.
So this means you might be copying the AutoHotkey.exe file more than you want to, but it will work. Getting other versions of AutoHotkey installed on the system is trickier, and that is what me and a few other users have tried to simplify. I should be able to find a forum link that will give you a few other options to try while work on making this script function better in a non-admin environment.

To answer some of your other questions, a binary is an .exe file. The .bin files are not what is meant when you see the word "binary" or "binaries" usually in reference to a program. Hope that helps :)
Last edited by TheArkive on 05 Feb 2021, 07:55, edited 2 times in total.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.11

Post by TheArkive » 05 Feb 2021, 07:41

@treflip

It can be set to not notify and block access (possibly).

I updated the OP, with these notes below that will help you with some other solutions while I try to make my script work better when registry access is not possible.

2 threads on this issue:
https://www.autohotkey.com/boards/viewtopic.php?f=37&t=63119&p=338767&hilit=Portable#p338767
https://www.autohotkey.com/boards/viewtopic.php?f=82&t=75824&p=333505&hilit=Portable#p333505

by EVIL-C
AHK EXE Swapper
GitHub: https://github.com/ahkscript/AHK-EXE-Swapper

by boiler
AltAHK Version (RAAV)
AHK v1: https://www.autohotkey.com/boards/viewtopic.php?f=6&t=76602
AHK v2: https://www.autohotkey.com/boards/viewtopic.php?f=83&t=76603
treflip
Posts: 3
Joined: 08 Jun 2015, 09:49

Re: AHK Portable Installer v1.11

Post by treflip » 05 Feb 2021, 11:43

@TheArkive

Thanks for the detailed information. Yes, I am trying to do this in an environment I don't have admin privileges with. I am sorry, I assumed that is typically the use case behind a portable version.

I have been able to do the exe swap method with the U64 version. For some reason the U32 prompts for access denied!

I took some time last night and updated my v1 script to v2. I am not sure what I am missing by only using the U64 version and not having AHK installed. (it feels very hacky but seems to run ok!)

Thanks again for the help. Let me know if you would like to test again sometime and I will give it a go!

Tre
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.11

Post by TheArkive » 05 Feb 2021, 12:13

@treflip

You aren't wrong, I guess my script is a bit of a "misnomer", unintentionally. I plan to fix that soon ;)

The nature of the "portableness" of my script is simply that you can easily move the entire contents of the main folder for all AHK versions, make a few changes in the script to note the new location, and continue on, without much fuss, and you can add new/alpha versions of AHK for testing without affecting your main version of AHK installed. But I'm afraid, as you pointed out, it isn't 100% portable, as this doesn't work on a system without admin rights.

The main intent of my script is to install some custom components to the system so that a simple comment like ; AHK v2 32-bit at the top of a script will suffice to ensure the script uses that version of AHK. My script actually associates a specific comment with a specific EXE of AutoHotkey, and you can add as many "match entries" as you like, so on run, the script is checked on the fly to see which version of AHK should be used to run it. You can make it very general, or very specific. In this way, you actually get a "pseudo installed" working version of AHK v1 and v2 at the same time. Since the components are actually "installed", again, admin rights are required.

I do scripts in AHK v1 and v2, and I do some dabbling in AHK_H v1/2 as well, hence the invention of this script.

I'm thinking of some ways to get the "effect" of my script without registry modifications. But this will not actually associate the .ahk extension in the system, so other means will need to be used in order to actually run the scripts.

Don't forget to check out some of the other versions of how to implement this functionality from my last post (also updated in the OP). You may find those useful. I'll be checking those out for ideas to assimilate to my script as well.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.12 (well... semi-portable)

Post by TheArkive » 16 Apr 2021, 10:49

Changes for v1.12:
  • updated for AHK v2 a131
  • now, when modifying a match string in "AHK Launcher" tab, the selected entry is simply updated, instead of refreshing the entire list.
  • Updated README
Check the OP for a poll about "Fully Portable" mode.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.13 (now fully portable)

Post by TheArkive » 16 Apr 2021, 18:08

Changes to v1.13:
  • Added "Compiler" button to access the compiler.
  • Added options to pick an icon, and included a few colors to choose from.
  • Added option to show/hide tray icon.
  • Added option to close to tray.
  • Added option to minimize on startup.
  • Added option to Run on system startup.
  • Added MButton hotkey to run script files on desktop and in file browser windows.
  • Added SHIFT + MButton hotkey to open script files in specified text editor.
  • added credits for Explorer_GetSelected().
  • Updated README.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.15 (now fully portable)

Post by TheArkive » 17 Apr 2021, 14:10

Changes for v1.15:
* Added conditions to prevent some overlooked registry checks/modifications when in portable mode.
* these checks should only happen in non-portable mode

Changes for v1.14:
* Added hotkey CTRL + MButton for compiling scripts.
* Removed "Ahk2Exe_Handler.ahk" and "AhkLauncher.ahk". The functions in these files are now in the main script file.
* Updated registry entries to point to the main script EXE (when not in portable mode).
* "AHK Launcher" and "Ahk2Exe Handler" now function in Fully Portable Mode.
* Significantly cleaned up the README.
* Updated tooltips with more helpful messages.
* Cleaned up old commented code.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.16 (now fully portable)

Post by TheArkive » 20 Apr 2021, 11:29

v1.16
  • Added "#SingleInstance Off" which prevents the script from prompting the user to close for another instance when in non-portable mode.
  • Now settings are not re-saved/written to disk every time the launcher runs a script or opens the compiler in non-portable mode.
  • Added a reminder, when running in non-portable mode, in the Regex edit sub-window (in AHK Launcher tab) to close the script for new settings to take effect.
WOlfen
Posts: 56
Joined: 14 Jan 2018, 16:48

Re: AHK Portable Installer v1.16 (now fully portable)

Post by WOlfen » 21 Apr 2021, 03:34

Thanks for all the work.
I will try that out. But the Github still shows the 1.10 Version as the latest one.
User avatar
TheArkive
Posts: 529
Joined: 05 Aug 2016, 08:06
GitHub: TheArkive

Re: AHK Portable Installer v1.16 (now fully portable)

Post by TheArkive » 21 Apr 2021, 05:29

I haven't been compiling releases lately. That is why. I'll try to clean that up on github
Post Reply

Return to “Scripts and Functions”