csavalas / HotkeyMapper

Hotkey Mapper for Lenovo Thinkpads
15 stars 0 forks source link

Setup.bat creates folder in wrong location #6

Open youwrote opened 1 month ago

youwrote commented 1 month ago

My user name and user folder consists of two words, first and last name. I usually don't work with spaces in system files but it seems I did on my laptop. Anyways, when I am running the setup.bat, the batch file creates a folder with my last name at the download/unzip location instead of the desired location, like so: "C:\Users\Firstname Lastname\Downloads\HotkeyMapper-main\HotkeyMapper-main\Installer\LASTNAME\AppData\Local\HotKeyMapper". I am on a WIN10 (newest) installation (German) on my AMD X13.

I also tried running and configuring via the executable in /resource/ but couldn't achieve any functionality so far. I have FN lock enabled via the BIOS and switched CTRL/FN there as well.

Here is the CMD output when running the setup.bat: Installing Thinkpad Hotkey Mapper...

Setting environment variables Changing to current working directory... Creating Installation Directory at C:\Users\Firstname Lastname\AppData\Local\HotKeyMapper... Copying main app... Copying helper executable... Copying uninstall script... Creating Start Menu links... Die Verknüpfung "C:\Users\Firstname Lastname\Start Menu\Programs\HotkeyMapper.lnk" wurde nicht gespeichert. In Zeile:1 Zeichen:199

Die Verknüpfung "C:\Users\Firstname Lastname\Start Menu\Programs\HotkeyMapper Uninstall.lnk" wurde nicht gespeichert. In Zeile:1 Zeichen:206

Installation complete! You may now delete this folder.

csavalas commented 1 month ago

I think I see the problem in my code. I just uploaded a new installer.zip, let me know if that works!

youwrote commented 1 month ago

Thanks for your prompt reply and fixing the batch file. The mkdir works as expected now, however the creation of the shortcuts/links still doesn't work since the directory for the Start Menu doesn't exist there for my WIN10 installation.

Also, when I try to remap any F-key, to play/pause media, it won't work either for "older" or "newer" model, same goes for other remappings that I tried. I tried key sequence and key combination. It works with PowerToys but that program detects my Fn-F10 as "S" and Fn-F11 as "D" and fires both on F10/F11 and S/D press, respectively, which is super annoying. If you're willing to do more troubleshooting, I'll happily assist.

This is on a ThinkPad X13 Gen 2 (AMD) with Win10 Pro 22H2. I have FN lock enabled via the BIOS and switched CTRL/FN active. Lenovo Vantage is NOT installed.

/edit: I came here via the reddit thread about key remapping from 3 yrs ago on r/thinkpad and also found the "simpler" version of this project by @OhShoot01. I tried that as well and installed Lenovo Vantage before, since he mentions it in his repo. The previous track feature works, play/pause and next track don't. I suspect my X13 Gen 2 AMD needs different values for play/pause and next track. Meh.

/edit2: sorry for derailing this issue thread. The shortcut/link portion is still relevant to here, everything else not so much. I'll try to see if I can open an issue over at OhShoot01's repo. I found that my machine with ISO-DE keyboard layout interprets Chr(179)/Chr(0xB3) as 3 cubed (³) instead of play/pause and Chr(176)/Chr(0xB0) as the degree sign (°) instead of next track. Chr(177) works for previous track as intended.

csavalas commented 1 week ago

Hey @youwrote , sorry for the delay, I was on vacation. Did you get this sorted out? If not, I can help you troubleshoot.

youwrote commented 1 week ago

Hi @csavalas, I hope you had a good one. Unfortunately, I didn't find a solution yet. I scanned through tables of special keys/characters but couldn't find any other reference for play/pause or next track apart from the ones already mentioned in my previous comment in this thread or how I would go about to make them compatible to my ISO keyboard.

csavalas commented 3 days ago

Hey @youwrote , just to make sure I understand where things are at right now, are you able to map your keys to other keys, just not the media keys? Or can you not map them at all?

Regarding the shortcut issue, I can see why that would be a problem on a German Windows installation. However, I don't see a clean way of supporting it, as there doesn't seem to be an environment variable for the Start Menu folder name. If you wanted, you could change lines 23 -24 to, and it should work for you, I think:

powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%\StartMenü\Programme\HotkeyMapper.lnk');$s.TargetPath='%LOCALAPPDATA%\%installdir%\%appmain%';$s.Save()"
powershell "$s=(New-Object -COM WScript.Shell).CreateShortcut('%userprofile%\StartMenü\Programme\HotkeyMapper Uninstall.lnk');$s.TargetPath='%LOCALAPPDATA%\%installdir%\%batuninstall%';$s.Save()"