rOzzy1987 / MacroPad

Replacement configuration software for chinese macropad keyboards
GNU General Public License v3.0
118 stars 7 forks source link

How set F13 - F24? #5

Open krzxsiek opened 9 months ago

krzxsiek commented 9 months ago

How to set F13 - F24 keys? I tried using AutoHotkey but no response :(

hashashin commented 9 months ago

I've used power automate, a 5 second delay and send key with {F13} and so on. https://learn.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/mouseandkeyboard

krzxsiek commented 9 months ago

I've used power automate, a 5 second delay and send key with {F13} and so on. https://learn.microsoft.com/en-us/power-automate/desktop-flows/actions-reference/mouseandkeyboard

Thanks but I found a simpler and faster solution in PowerShell (Terminal), it doesn't require any tools :) Unfortunately, this method has one drawback, it only works for F13 - F16 :( https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.sendkeys?view=netframework-4.8.1

# Add the System.Windows.Forms external library
Add-Type -AssemblyName System.Windows.Forms

# 5-second delay
Start-Sleep -Seconds 5

# Simulate pressing the F13 key
[System.Windows.Forms.SendKeys]::SendWait("{F13}")

# Wait for the Enter key to be pressed before ending the script
Read-Host "Press Enter to exit..."

P.S. However, AutoHotkey works, I just had to make a new build from the source files because the KeyCode.cs file was updated 2 days ago in which the author added F13 - F24

kevenduchesneau commented 6 months ago

@krzxsiek could you share your AHK script to send F13-24 keys to the macropad software? I haven't been able to make it work on my end using the latest version (2.0.11).

krzxsiek commented 6 months ago

@krzxsiek could you share your AHK script to send F13-24 keys to the macropad software? I haven't been able to make it work on my end using the latest version (2.0.11).


#NoEnv
#Singleinstance, Force

StringSplit, ScriptNameArray, A_ScriptName,_
MsgBox, 0, Auto keyboard clicker, Click F1 and wait for the key to be automatically `ncalled %ScriptNameArray1% given in the file title :)
getKey := ScriptNameArray1

F1::
    ;MsgBox, 0,, Now wait 5s
    Sleep 5000
    Send {%getKey%}
    Sleep 1000
    MsgBox, 4,, Are we done?
    IfMsgBox Yes
        ExitApp
return

File name is: F13button F13-F24.ahk Change first number in file name F13,F14,F15... AHK version: 1.1.37.01