This does not seem to be your real script. In any case, you can fix the flow. Read: #IfWinActive. It applies only to hotkeys & hotstrings. You would not have two of these directives on consecutive lines, because the first one would not have any effect. Shorten your script so that you can test the specific problem and fix it. You can expand from there.
Here is an example of how to use the directive: https://www.autohotkey.com/boards/viewtopic.php?p=414145#p414145
Stop label/send keystrokes Topic is solved
Re: Stop label/send keystrokes
I have made a mistake with copy secound script I saw it now, I repaird itHajdes wrote: ↑08 Aug 2021, 05:48Ok I made it and it work like that:mikeyww wrote: ↑07 Aug 2021, 20:19I do not understand it and cannot test it. My advice is to test your script in Notepad to see whether it works there. That will help you to understand whether the problem is the script or the game.
Of course, closing this script with the tray icon is tricky, because your right button is mapped. You might need a different method to close the script. It also seems apparent that you are not showing your entire script here.But I have got problem with my secound label it is more complicated and my idea don't work in it:Code: Select all
LabelKey = Numpad0 LabelNumber = 10 #IfWinActive ahk_class grcWindow #IfWinActive, ahk_exe GTA5.exe Hotkey, %LabelKey%, Label Label: abc=1 SoundBeep, 300, 100 PhoneUp() Send {Right}{Up}{Enter} a := 0 while(LabelNumber>a) { Send {Up} a := a+1 } Send {Enter} return ~RButton:: ;esc/backspace is the same code if(abc=1) || (abc=2){ Run script.ahk eksit() return } return eksit(){ ExitApp }
Any ideas to repair it?Code: Select all
#SingleInstance, Force Global PhoneDelay := 500 global k global c:= false global abc:= 0 LabelKeyB = Numpad1 LabelKeyC = Numpad2 Hotkey, %LabelKeyB%, LabelB Hotkey, %LabelKeyC%, LabelC return #IfWinActive ahk_class grcWindow #IfWinActive, ahk_exe GTA5.exe LabelB: abc=2 SoundBeep, 300, 100 if(c=true){ if (true=k){ InteractionMenu() Send {Down 5}{Enter}{Up 5}{Right}{Enter} Send {m} } else{ InteractionMenu() Send {Down 4}{Enter}{Up 5}{Right}{Enter} Send {m} } } else MsgBox,, Script, ERROR, first use key: %LabelKeyC% return LabelC: SoundBeep, 300, 100 KMSS() return ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ KMSS(){ APZ() MSGBox, 4, Script, Yes/No? IfMsgBox Yes k := true else k := false } return ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ APZ(){ c:=true } ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ InteractionMenu(){ Send {m} sleep, %PhoneDelay% } return ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ~RButton:: if(abc=1) || (abc=2){ Run script.ahk eksit() return } return eksit(){ ExitApp }
Re: Stop label/send keystrokes
I can't post full code here because it has got 400 linesmikeyww wrote: ↑08 Aug 2021, 06:46This does not seem to be your real script. In any case, you can fix the flow. Read: #IfWinActive. It applies only to hotkeys & hotstrings. You would not have two of these directives on consecutive lines, because the first one would not have any effect. Shorten your script so that you can test the specific problem and fix it. You can expand from there.
Here is an example of how to use the directive: https://www.autohotkey.com/boards/viewtopic.php?p=414145#p414145
Re: Stop label/send keystrokes
It sounds like you are all set for now. If you have follow-up questions, providing the following information will help at that time.
1. Relevant portion of the script, so that the reader can test it
2. Description of what actually happens when you run the script
3. Description of what should happen when you run the script (desired output, actions, effects, etc.)
I will let others reply to the new post, in case additional solutions are offered.
1. Relevant portion of the script, so that the reader can test it
2. Description of what actually happens when you run the script
3. Description of what should happen when you run the script (desired output, actions, effects, etc.)
I will let others reply to the new post, in case additional solutions are offered.
Who is online
Users browsing this forum: No registered users and 63 guests