Page 1 of 1

Help : how to make me script work in the background

Posted: 01 Mar 2024, 04:30
by konafa100
1-How can I make this script run only on a specific Nameof game.exe in the background while I work on another window with the same name
Nameof game.exe
/ no need in WinActivate -- i need in ]Hide win in background like this { DetectHiddenWindows, On
Send,, {RButton}, ahk_exe example.exe

Code: Select all

#Persistent
SetTimer, PressTheKey, 200
Return

PressTheKey:
SoundBeep, 1500
WinGet, win, List, ahk_exe Nameof game.exe
Loop, %win% {
 WinActivate, % "ahk_id " win%A_Index%
Send,{RButton}
sleep, 10
Send,{LButton}
sleep, 10
send {LCtrl down}
sleep, 10
Send,{f10}{f10}
sleep, 10

}
Return
#1::Pause


1::Pause

Re: Help : how to make me script work in the background

Posted: 01 Mar 2024, 17:53
by gregster
I have separated the discussion about font color usage from this topic. Now, it can be found here: viewtopic.php?f=81&t=126753

Re: Help : how to make me script work in the background

Posted: 13 Mar 2024, 03:19
by konafa100
if i have 2 Processes 1- Nameof game.exe 2- Nameof game.exe
i need to choose only one Processes -
and run script on the background -
to play on another Nameof game.exe processes --
and thx alot
Update code

Code: Select all

#Persistent
SetTimer, PressTheKey, 200
Return

PressTheKey:
Loop, 1
{

SetTitleMatchMode, 2
CoordMode, Mouse, Window

tt = [Nameof game] ahk_class Afx:400000:0:10003:0:0
WinWait, %tt%
IfWinNotActive, %tt%,, WinActivate, %tt%

Send, {Blind}{Ctrl Down}{F10}

MouseClick, L, 1137, 170
sleep, 4

MouseClick, R, 1139, 171

MouseClick, R, 1139, 171

ImageSearch, foundX, foundY, 0, 0, 1920, 1080, E:\111.png
If(ErrorLevel == 0){
send,{f5 down}
sleep 1
send,{f5 up}
}
sleep, 10
ImageSearch, foundX, foundY, 0, 0, 1920, 1080, E:\222.png
If(ErrorLevel == 0){
send,{f5 down}
sleep 1
send,{f5 up}
}
sleep, 10

MouseClick, L, 1323, 189

MouseClick, R, 1323, 191
ImageSearch, foundX, foundY, 0, 0, 1920, 1080, E:\333.png
If(ErrorLevel == 0){
send,{f5 down}
sleep 1
send,{f5 up}
}
sleep 10

MouseClick, R, 1323, 195,,, D

Send, {Blind}{F10}

MouseClick, R, 1323, 195,,, U

MouseClick, L, 1338, 207

Send, {Blind}{F10}{Ctrl Up}

Sleep, 1000

}
#1::
Pause,, 1
Send, {LCtrl Up}
Return