![]() I tried your suggestion on the 2nd one which you described as being much closer using this: f9:: I am getting closer to what I want to achieve but also more confused unfortunatley. But a return is always reached in this one, so that's a plus. #AUTOHOTKEYS CANT GET MEDIAKEYS TO WORK UPDATE#A few changes are necessary: while state:=GetKeyState("c","p"), change it so the if checks for a value of "1" instead of "D" - If state = 1, and also you should drop the "else" or else when state does = 1, it will skip over the return after the while loop is done because all 7 of those lines after the while loop are associated with it, thanks to the If/else being subsets.Īgain, no looping to update the value of state or just having a while loop evaluating an expression. You could implement a state variable, but it's unnecessary. Even if you correct the while expression to use the GetKeyState function like I used above, there will no longer be a state variable. If you test this script, you'll notice nothing happens. Similar to the above, the While syntax is wrong and you'd need the () function. It literally is looking at the values of variables GetKeyState and state and c But that's the problem - you've not passed an expression. This is an improvement from the first one because the while loop would attempt to evaluate it the expression. You are much closer here, but use while GetKeyState("c","p"). Why is this one wrong? You would need to use the function inside of the While here. The GetKeyState command is run one time, the value of State is set as D, and your while-loop begins without ever checking the key state again. Why is this one wrong? Because the variable state does not update during the loop. But I'll try to explain why each of the above four attempts were wrong - learning from your mistakes is one of the most powerful ways to learn. On most of these I get an error whenever I try to run them saying the variable D is unassigned. I have read and re-read the help file on loop and GetKeyState, and While-Loop, but the best I have been able to do is to get the MsgBox after else to display. I feel like any one of these should work but none of them do, so there must be something I am fundementally misunderstanding. Here is a few of the things I have tried so far: +c:: Which seems like it should be easy but I can't get it to work. I just want a hotkey that repeats while pressed. I have tried every version of this I can think of but none seem to work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |