Hi,
I just found AutoHotKey on google yesterday
I was searching for a way to control Foobar2000 with the 2 useless buttons on each side of the wheel.
I've play/pause and vol up/down on my keyboard, so I tought it could be great if I could use my mouse to skip the songs forward and backward.
To make it short: these buttons aren't xButton1/2 and were undetectable by AutoHotKey, I downloaded SetPoint & Uberoptions, next I assigned F21 & F22 to it.
Here is my script, working:
Code:
;FORWARD
~F22::
{
NextSong: ;skip song
GetKeyState, vButtonFWD, F22
if vButtonFWD = U
{
if A_TimeSinceThisHotkey < 190
{
SendInput {F14}
}
}
else if A_TimeSinceThisHotkey < 190
{
goto NextSong
}
else if vButtonFWD = D
{
if A_TimeSinceThisHotkey >= 190
{
loop ;seek in song
{
if vslowtofast < 16
{
SendInput {Media_Next}
Sleep, 200
vslowtofast ++
}
else
{
SendInput {Media_Next}
Sleep, 70
}
GetKeyState, vButtonFWD, F22
if vButtonFWD = U
{
vslowtofast = 0
break
}
}
}
}
}
return
;BACKWARD
~F21::
{
PrevSong: ;skip
GetKeyState, vButtonBWD, F21
if vButtonBWD = U
{
if A_TimeSinceThisHotkey < 190
{
SendInput {F13}
}
}
else if A_TimeSinceThisHotkey < 190
{
goto PrevSong
}
else if vButtonBWD = D
{
if A_TimeSinceThisHotkey >= 190
{
loop ;seek
{
if vslowtofast < 16
{
SendInput {Media_Prev}
Sleep, 200
vslowtofast ++
}
else
{
SendInput {Media_Prev}
Sleep, 70
}
GetKeyState, vButtonBWD, F21
if vButtonBWD = U
{
vslowtofast = 0
break
}
}
}
}
}
return
Keys assigned in Foobar:
-F13 and F14: Previous and Next
-Media_prev and Media_next: Seek back and seek ahead
What it does:
-A short clic will skip the song;
-Hold the button down will seek in the song,
-Hold longer will seek faster (after +/- 3sec)
The script is working, but I still have some questions (The last time I've scripted ... 1 or 2 years ago, in NeverWinter Nights... and I wans'nt skilled

):
-> I first try(for exemple)
Code:
if vButtonFWD = U && A_TimeSinceThisHotkey < 190
It didn't work, I had to put a
if into a
if. Why?
-> Without "return" at the and of each button script, It didn't work as well as they are present... But in fact, I don't know the maining of "return"...
-> Is it possible to make this script looking better?
Thanks
PS: I usually speak french, sorry for any language mistake...
PS2: You can't feel it in the message, but in fact I worked on it for HOURS
