Run, ExitApp problem, make code shorter.

Ask gaming related questions (AHK v1.1 and older)
Hajdes
Posts: 38
Joined: 30 Jul 2021, 17:29

Run, ExitApp problem, make code shorter.

09 Aug 2021, 07:49

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
}
I have got problem with code above, It should after clicking rmb run script.ahk and close this script but it don't work.If I run script it is running normaly but the rmb don't work, but when I put (abc=2) 1/2/3 line/s down script is going crazy he is sending msgbox after starting label.
Any ideas how to short it / repair it?
Rohwedder
Posts: 7774
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Run, ExitApp problem, make code shorter.

09 Aug 2021, 09:16

Hallo,
The RButton hotkey triggers only in an active GTA5.exe window and if(abc=1) || (abc=2)

Code: Select all

; ...
#IfWinActive, ahk_exe GTA5.exe
; ...
~RButton::
if(abc=1) || (abc=2)
{
	Run script.ahk
	eksit()
	return
}
Hajdes
Posts: 38
Joined: 30 Jul 2021, 17:29

Re: Run, ExitApp problem, make code shorter.

09 Aug 2021, 09:52

Rohwedder wrote:
09 Aug 2021, 09:16
Hallo,
The RButton hotkey triggers only in an active GTA5.exe window and if(abc=1) || (abc=2)

Code: Select all

; ...
#IfWinActive, ahk_exe GTA5.exe
; ...
~RButton::
if(abc=1) || (abc=2)
{
	Run script.ahk
	eksit()
	return
}
Yes I know but in LabelB where abc=2 rmb don't work

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 66 guests