(English is my 3th language, so... a sorry ahead of times is in order. Sorry)
TL:DR at the bottom.
I have been a lurker for a few years until today!
My problem is the following:
In order to reduce strain on my left hand, i want to put two keys in one, the codes i have tried, they worked 90% of the time but the remaining 10% is the one that bugs me. This is the one that works most of the time.
Code: Select all
$Space::
SendInput, {LCtrl Down}
Sleep, 50
SendInput, {Space Down}
return
$Space Up::
SendInput, {Space Up}
SendInput, {LCtrl Up}
return
I have also tried with this and either LCtrl gets stuck down or Space Up:: end up sending a "Send {Space}"
Code: Select all
$Space::
While GetKeyState("Space", "P")
SendInput, {LCtrl Down}
Sleep, 50
SendInput, {Space Down}
return
$Space Up::
SendInput, {Space Up}
SendInput, {LCtrl Up}
return
Code: Select all
~$LButton::
While GetKeyState("LButton", "P") and (toggle = true){
Send, {Click}
Sleep, 100
}
return
Now, there is a way to fix the error, removing "Sleep" but it removes the point of the script.
I tried with SetKeydelay and Send instead of Sendinput it's even worst, it sends space in a loop.
Offtopic:
What is the difference between (and are they written correctly?):
Code: Select all
SpaceIsDown:
{
Sendinput, {LCtrl Down}
Sendinput, {Space Down}
}
Return
SpaceIsUp:
{
Sendinput, {Space Up}
Sendinput, {LCtrl Up}
}
return
Space::GoSub, SpaceIsDown
Space Up::GoSub, SpaceIsUp
Code: Select all
SpaceIsDown()
{
Sendinput, {LCtrl Down}
Sendinput, {Space Down}
}
Return
SpaceIsUp()
{
Sendinput, {Space Up}
Sendinput, {LCtrl Up}
}
return
Space::SpaceIsDown()
Space Up::SpaceIsUp()
Code: Select all
SpaceIsDown::
Sendinput, {LCtrl Down}
Sendinput, {Space Down}
Return
SpaceIsUp::
Sendinput, {Space Up}
Sendinput, {LCtrl Up}
Return
So my question? Well, why does "Sleep" impact the script so much and is there a way around it? To have a delay between LCntrl and Space without Sleep nor SetKeyDelay?
And again Thank you very much for reading