rbreaves / kinto

Mac-style shortcut keys for Linux & Windows.
http://kinto.sh
GNU General Public License v2.0
4.27k stars 214 forks source link

Cannot install on windows 10: kinto.ahk error on line 55 (missing param) #689

Closed rbutera closed 2 years ago

rbutera commented 2 years ago

Describe the bug Cannot install on windows 10 - getting error with kinto.ahk script

Expected behavior Installation succeeds

Install Type: Powershell Distro: Windows 10 Logs and status if relevant

Screenshots AutoHotkey_Yvfp6Uz0hy

Additional context I've tried selecting both windows keyboard and apple keyboard ( I have both)

I didn't have chocolatey or autohotkey installed prior to running the powershell script

Logs

PS C:\Users\Rai\Downloads\kinto-master> iwr https://raw.githubusercontent.com/rbreaves/kinto/master/install/windows.ps1 -UseBasicParsing | iex
WARNING: 'choco' was found at 'C:\ProgramData\chocolatey\bin\choco.exe'.
WARNING: An existing Chocolatey installation was detected. Installation will not continue.
For security reasons, this script will not overwrite existing installations.

Please use choco upgrade chocolatey to handle upgrades of Chocolatey itself.
Chocolatey v1.1.0
Installing the following packages:
python3
By installing, you accept licenses for the packages.
python3 v3.10.5 already installed.
 Use --force to reinstall, specify a version to install, or try upgrade.

Chocolatey installed 0/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Warnings:
 - python3 - python3 v3.10.5 already installed.
 Use --force to reinstall, specify a version to install, or try upgrade.

You are detected as running Windows.
    1. Apple keyboard standard
    2. Windows keyboard standard
    3. Chromebook
    4. IBM - No Super/Win
    5. Uninstall

Please enter your desired keymap (1 - 5) : 1

Will now install chocolatey and autohotkey with elevated privileges...
This install will fail if you are not running with elevated privileges
Chocolatey is already installed
Autohotkey is already installed
Chocolatey v1.1.0
Installing the following packages:
strawberryperl
By installing, you accept licenses for the packages.
strawberryperl v5.32.1.1 already installed.
 Use --force to reinstall, specify a version to install, or try upgrade.

Chocolatey installed 0/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Warnings:
 - strawberryperl - strawberryperl v5.32.1.1 already installed.
 Use --force to reinstall, specify a version to install, or try upgrade.
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
Copying autohotkey combinations for Terminals & Editors...
        1 file(s) copied.
The system cannot find the path specified.
The system cannot find the path specified.
Would you like to use Sublime Text 3 keymaps in VS Code?
 (Y/n) n

Will now install Ubuntu Terminal Theme as default...

-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows
-------------------------------------------------------------------------------

  Started : 08 June 2022 17:10:12
   Source : C:\Users\Rai\Downloads\kinto-master\assets\
     Dest : C:\Users\Rai\.kinto\assets\

    Files : *.*

  Options : *.* /S /E /DCOPY:DA /COPY:DAT /R:1000000 /W:30

------------------------------------------------------------------------------

                          10    C:\Users\Rai\Downloads\kinto-master\assets\

------------------------------------------------------------------------------

               Total    Copied   Skipped  Mismatch    FAILED    Extras
    Dirs :         1         0         1         0         0         0
   Files :        10         0        10         0         0         0
   Bytes :    1.00 m         0    1.00 m         0         0         0
   Times :   0:00:00   0:00:00                       0:00:00   0:00:00
   Ended : 08 June 2022 17:10:12

        1 file(s) copied.
The system cannot find the path specified.
        1 file(s) copied.
        1 file(s) copied.
Cannot create a file when that file already exists.
        1 file(s) copied.
        1 file(s) copied.
        1 file(s) copied.
Starting... "C:\Users\Rai\AppData\Roaming\Microsoft\Windows\STARTM~1\Programs\Startup\kinto-start.vbs"
If using WSL then please remember to right click on title bar -> Properties -> Edit Options -> Use Ctrl+Shift+C/V as Copy/Paste and enable it.
PS C:\Users\Rai\Downloads\kinto-master>
rbreaves commented 2 years ago

I’m not sure but I don’t think you installed this under Admin?

rbutera commented 2 years ago

@rbreaves I ran powershell as Administrator

rbutera commented 2 years ago

@rbreaves I have no experience with virtual basic, but I think the problem is with this line:

strFolder = fso.BuildPath( path, "\.kinto\kinto.ahk"" {kbtype}")

I think kbtype ends up as undefined/null here. I can see that the intention is that the python script sets an environment variable to kbtype, but how does this line interpolate the variable? Is that what the {kbtype} syntax does?

rbutera commented 2 years ago

Just tried on a fresh windows 11 install and had the same issue

rbreaves commented 2 years ago

I strongly suspect you are having an issue with Strawberry Perl then - according to your log it installed, but there is also indication of 2 paths of files not being found... perhaps that is a line indicating that my installer then tried to run the Strawberry Perl app to configure Kinto but failed for some reason..

...
Warnings:
 - strawberryperl - strawberryperl v5.32.1.1 already installed.
 Use --force to reinstall, specify a version to install, or try upgrade.
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..
Copying autohotkey combinations for Terminals & Editors...
        1 file(s) copied.
The system cannot find the path specified.
The system cannot find the path specified.
...

~Aka I think your Powershell terminal, for whatever reason is not putting Strawberry Perl into your binary path for it to run. I do not know why - as this has never occurred on any of my Windows 10/11 installs. Worse case scenario that I would have figured would you having some other version of Perl installed and that creating an issue, but again~ seems like it just isn't finding perl at all is what I think is happening - which would explain why things like {kbtype} are not being replaced - can only happen if Perl did not run successfully for you.

rbreaves commented 2 years ago

Follow up post, yup. Fix your perl. Not sure why it wouldn't work on your install normally though or why it would do it on a fresh install for you. I dog food this constantly - I'd fix it if it was reproducible for me - but I can tell you right now that it isn't, so I assume it is unique to your setup for some reason.

Please report back on what's up with your Perl and if I can integrate a fix I will, otherwise I am closing this ticket as I do not think there is anything I can do further to help.

setup.py

...
    print("Copying autohotkey combinations for Terminals & Editors...")
        os.system('copy /Y "' + path + '\\windows\\kinto.ahk" "' + homedir + '\\kinto-new.ahk"')
    if default < 3:
        os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; Default)(?!( - ST2CODE))(.*)/$2$3$5/gm" ' + homedir + '\\kinto-new.ahk')
    if default == 1:
        kbtype = "mac"
        os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/gm" ' + homedir + '\\kinto-new.ahk')
    elif default == 2:
        kbtype = "win"
        os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/(; )(.*)(; WinModifiers)/$2$3/gm" ' + homedir + '\\kinto-new.ahk')
...

Also line 73 of same file

...
os.system('C:\\Strawberry\\perl\\bin\\perl.exe -pi -e "s/{kbtype}/' + kbtype + '/gm" "%userprofile%\\.kinto\\kinto-start.vbs"')
...

If you can't run commands like these in Powershell then your perl install needs fixing. I am sure there are likely more replacements happening than just these 2, but they're pretty big ones lol.

C:\Strawberry\perl\bin\perl.exe -pi -e "s/{kbtype}/' + kbtype + '/gm" "%userprofile%\\.kinto\\kinto-start.vbs"
C:\Strawberry\perl\bin\perl.exe -pi -e "s/(; )(.*)(; MacModifiers)/$2$3/gm" "%userprofile%\.kinto\kinto.ahk"
sickerin commented 2 years ago

@rbutera I think you can try choco install strawberryperl --force. I had the same issue, but this was because I accidentaly deleted some Strawberry Pearl files, while clearing my old files. So it was a bit incomplete and didn't properly raise an error/ wasn't able to be uninstalled using the kinto uninstall scripts.