vendredi 29 juillet 2016

Autohotkey condition issue

the code still driving me crazy tried like everything in my mind but still not working. i am out of tries and ideas

here is the exact code:

MaxPresses := 2
Presses := 0
Lock := 0
~Up::
if (Presses > 0)
{
Presses -= 1
TrayTip, %A_ThisLabel%, presses is %Presses%
}
[b][u]else[/u][/b]
{
Lock := 1
Hotkey, Up, DoNone
DoNone:
return
TrayTip, %A_ThisLabel%, lock is %Lock%
}


return
/*
~Down::
if (Presses != 2)
{
Presses += 1
}
return
*/


~NumpadEnter::
~Enter::

Presses += 1

;SetTimer, ResetPresses, -25000


If (Presses <= MaxPresses)

    GoSub, Presses%Presses%
;TrayTip, %A_ThisLabel%, presses is %Presses%
return
;ResetPresses:

;Presses := 0

;return



Presses1:
if (Lock = 1)
{
Lock := 0
Hotkey, Up, ~Up
TrayTip, %A_ThisLabel%, lock is %Lock%

}
return



Presses2:

some action

return

If (Presses <= MaxPresses)

also at this part, it doesnt gosub until i change Presses to Pressed although there is no Pressed var in the whole script and when i change it to pressed the rest of the conditions doesnt work. i am really confused and dont have any clue why this happening at all...

plus When I use this code with

else if

marked with bold and underline tags: the condition of lock var works which make the up button not working temporarily but it does stop working on 0 presses but -1 for some reason. Means the up button still works when it is zero i don't know why tbh but when I change else if with if only it stops st zero but the lock condition doesn't work. It just disable the key on 0 press exactly but never re-enable it when enter is pressed and adds more presses to var.

appreciate all the help if possible, thanks ^^

Max

Aucun commentaire:

Enregistrer un commentaire