zed6250jb wrote: ↑23 Apr 2024, 18:01
Thanks for your reply Mike, Incidentally, the roku/hisense tv remote was solely at fault for their crappy implementation of an ir remote. I bought another ir remote made by direct-tv (black a white, and shapely, I guess it's called a genie or something) and seems to work flawlessly. Here is the last and likely final update to the repo. Thanks for your attention again, and sorry if I took your time.
https://github.com/zed6250JB/ahkFLIRC/blob/main/rebind.ahk
I saw the code over there and noticed you can simplify a bit by using the
switch/case statements or if statements if you prefer.
This is probably what you were attempting to achieve when you were stacking your hotkeys on your OP, not sure.
Code: Select all
#HotIf WinActive("ahk_exe HD-Player.exe")
$up::
$down::
$left::
$right:: {
switch hk := StrReplace(A_ThisHotkey, "$")
{
case 'up': x:= 0 , y:= -8
case 'down': x:= 0 , y:= 8
case 'left': x:= -8, y:= 0
case 'right': x:= 8 , y:= 0
}
While GetKeyState(hk, 'P') {
MouseMove x, y , 45, "R"
Sleep 1
}
}
$^m::
$\:: {
switch hk := StrReplace(A_ThisHotkey, "$")
{
case '\': button := 'middle'
case '^m': button := 'left', hk := StrReplace(hk, '^')
}
While GetKeyState(hk, 'P') {
MouseClick button
Sleep 1000
}
}
$,::
$.:: {
switch hk := StrReplace(A_ThisHotkey, "$")
{
case ',': direction := 'down'
case '.': direction := 'up'
}
While GetKeyState(hk, 'P') {
Send "{Wheel" direction "}"
Sleep 1
}
}
$f1::
$f2:: {
switch hk := StrReplace(A_ThisHotkey, "$")
{
case 'f1': key := 'left'
case 'f2': key := 'right'
}
Send "{" key "}"
Sleep 100
}
$!z:: {
{
MouseMove 198,1080
Sleep 100
}
}
#HotIf
I noticed that on a few of them you didnt use the
GetKeyState function, is there a reason for that?