Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

Ask gaming related questions (AHK v1.1 and older)
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 02:15

the ahk script should immediately stop what its doing as soon as it looses either focus to said app, meaning it would save last steps executed while immediately stopping said execution/s and then continue on refocus of said app etc. and to stop execution completely if app crashes on startup etc. , which can happen sometimes
Last edited by BoBo on 22 Jul 2020, 13:22, edited 1 time in total.
Reason: Moved to Gaming section.
BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 02:37

a) AFAIK, AHK won't stop an already executed command eg. breaking a Loop without (user/another script) intervention from the outside.
b) "Request for a script ..." sounds like someone should write it for you without any effort from your side (besides writing this request), please confirm!?
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 03:35

b , is confirmed , yes , since ive got 0 skills for this , hence why its in the ask for help section

and A, yes , and if additional script where required i wouldnt complain

thanks in advance for the help with this little issue of mine with this one, appreciated
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 04:24

If your Ahk script itself launches the "said app" then it can catch Pid of the "said app". Having a Pid you can monitor the "said app" and procede as desired! Similar to this thread.
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 04:47

tobsto occupied wrote:
03 Jun 2020, 03:35
ive got 0 skills
I disagree! In the above linked thread you're launching some app. Do it here too! Catch the Pid as shown in my answer there and start the timer to monitor launched app. Just give it a shot and I'm sure you'll get help to procede/improve!
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 06:02

ok ...but uhhhh pid constantly changes with cmd, tried by multiple launches, so perhaps something else than pid then?

btw still have no freakin clue how to autostop a script on app focus loss and continue on refocus from where it left off
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 09:47

I think what are you doing is:
1. run ahk script
2. ahk script launches cmd (bat file)
2.1 bat file launches some app(s)
Now ahk script should monitor this app(s).

If so, then II suggest you should do as follows:
1. run ahk script
2. ahk script launches some app(s)
Now ahk script should monitor this app(s)

Pseudo code:

Code: Select all

run, some app, dir,, Pid
WinWaitActive, % "ahk_pid" Pid

;Do some command (one at a time)
Gosub CheckFocus
;Do some command (one at a time)
Gosub CheckFocus
; and so on
;...

ExitApp ; ends this script (if needed)
Return

CheckFocus:
    while !WinActive("ahk_pid" Pid) ; if app looses focus the script will sleep, and continue after regaining the focus
        sleep, 100
Return
Come on, it's not so complicated!
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 10:21

not sure if youve noticed but im dumb as fuck , so babysteps sorry :? , complicated? trust im really working em braincells ..the few i have real hard and im gettin a headache , so as said babysteps and alot of explainin it is with me aka step by step , once again sorry bout that i can be a real headache myself i know :problem:

btw i kinda get it but not quite , please apply said example to this AHK of yours>

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases. 
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Client
;run, Devil May Cry 5_steamlaunch_batch_mode_.bat, D:\Games\Steam,, Pid ; run and catch Pid
;WinWait, % Title:= "ahk_pid" Pid,, 30

; Instead a game launching batch we run a test batch (see below)
run, batchPause.bat, A_ScriptDir,, Pid ; run and catch Pid
WinWait, % Title:= "ahk_pid" Pid,, 30
SetTimer, WatchCmd, 300

WinActivate, % Title
WinWaitActive, % Title,, 30

Sleep, 5000 ; try perssing any key twice before 5 Seconds run off
;Send, y ; here "y" terminates timeout
ControlSend,, y, % Title ; alternative that works even if cmd is not active

sleep, 3000 ; incresed only one can read cmd
;Send, {Enter} ; here "Enter" terminates cmd
ControlSend,, {Enter}, % Title ; alternative that works even if cmd is not active

SetTimer WatchCmd, Off ; just for this test
SoundBeep, 1200  ; short low followed by long high beep indicates launching the game (only for demo test)
SoundBeep, 2400, 500
ExitApp ; terminatig the test 'cause from here on there's no prob' I guess...

Sleep, 5000
WinWait, % Title:= "Steam Login ahk_exe Steam.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30

Send, 'my password for steam'
sleep, 300
Send, {Enter}

ExitApp

WatchCmd:
    if !WinExist("ahk_pid " Pid) { ; you can replace "WinExist" with "WinActive" if you like
    ;if !WinActive("ahk_pid " Pid) {
        SoundBeep, 2400 ; replace these two lines with your exiting code (see my guess below)
        SoundBeep, 1200, 500 ; short high followed by long low beep indicates closing the game (only for demo test)
        ;WinClose, % TitleToClose:= "ahk_exe Devil May Cry 5.exe" ; guessing game you want to exit
        ;WinWaitClose, % TitleToClose
        ExitApp ; alternative for reload below:
       ;Sleep, xxx ; you have to determine how long sleep you need if at all
       ;Reload
    }
Return
Last edited by gregster on 03 Jun 2020, 10:27, edited 1 time in total.
Reason: Code tags added. Please use them, tHank you!
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 10:42

and how do integrate this batch into it , since you mentioned integrating them together so its a full ahk script

Code: Select all

@echo OFF
start "" "steam://rungameid/601150"
TIMEOUT /t 30
start /min "" "DMCVTrainer.exe"
start /min "" "SSSiyanCollabTU5.CT

for /f "tokens=*" %%f in ('wmic cpu get NumberOfCores /value ^| find "="') do set %%f
GetNumberOfCores.cmd

:Restart
:: starting and assigning your process(es)
set "process_name=DevilMayCry5.exe"

timeout /t 1

::remove .exe suffix if there is
set pn=%process_name:.exe=%

setlocal enableDelayedExpansion

:: this is threshold for 10% (percent)
set /a threshold=3

:CheckCpuLoad
set /a counter=0
:: getting three snapshots of CPU usage of the given process
for /f skip^=2^ tokens^=3^ delims^=^" %%p in ('typeperf "\Process(%pn%)\%% Processor Time"  -sc 3') do (
    set /a counter=counter+1
rem     for /f "tokens=1,2 delims=." %%a in ("%%p") do set "process_snapshot_!counter!=%%a%%b"
    for /f "tokens=1,2" %%a in ("%%p") do set "process_snapshot_!counter!=%%a"
)

:: convert to percentage
set /a process_snapshot_1/= %NumberOfCores%
set /a process_snapshot_2/= %NumberOfCores%
set /a process_snapshot_3/= %NumberOfCores%

:: comment three lines below when threshold is set correctly
@echo %process_snapshot_1%
@echo %process_snapshot_2%
@echo %process_snapshot_3%

TIMEOUT /t 1

rem I modified below condition check since I don't fathom the original one!
:: if all three snapshots are less than 0000010 (now threshold) process will be killed
if %process_snapshot_1% LSS %threshold% if %process_snapshot_2% LSS %threshold% if %process_snapshot_3% LSS %threshold% (
     tskill %pn%
     taskkill /F /T /IM %process_name%
) & goto RUNNING

timeout /t 1
GOTO CheckCpuLoad

:RUNNING
tasklist|findstr DevilMayCry5.exe > nul
if errorlevel 1 (
    timeout /t 1
    taskkill /F /T /IM cheatengine-x86_64.exe
    taskkill /F /T /IM DMCVTrainer.exe
    taskkill /F /T /IM Steam.exe
    taskkill /F /T /IM Werfault.exe
) & GOTO ENDLOOP
timeout /t 1
GOTO RUNNING

:ENDLOOP
:: reduce to 1 for the final script!
timeout /t 1

:: optionally to restart again (remove 'rem' below)
rem goto Restart

exit /B
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 10:57

oh before i forget it the ahk should be able to autoexit the full process in said ahk script as soon as the game crashes


p.s, theres only one batch left in this equation after that and that one is required for launching steam itself with some extra parameters which i need aka the

Devil May Cry 5_steamlaunch_batch_mode_.bat
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 11:10

Don't try to write the whole script at once! Start it one step at a time!
To "integrate" batch is simple, you have to translate it to ahk line by line:
start is run,
timeout is Sleep
the label :Restart is Restart:
and so on..
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 12:09

like such? btw still dont know how to set the Gosub CheckFocus to be tied to dmc5.exe, so as soon as dmc5 exits all gets killed immediately or as said if focus lost and continued where it left off on refocus, also starting from line > run "" "steam://rungameid/601150" before that this part>

Code: Select all

WinWait, % Title:= "Steam Login ahk_exe Steam.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30

Gosub CheckFocus
Send, 'my password for steam'
Gosub CheckFocus
sleep, 300
Gosub CheckFocus
Send, {Enter}
Gosub CheckFocus
Gosub CheckFocus should be tied to steam.exe


so this is what i got as of currently >

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases. 
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Client
run, Devil May Cry 5_steamlaunch_batch_mode_.bat, D:\Games\Steam,, Pid ; run and catch Pid
WinWait, % Title:= "ahk_pid" Pid,, 30

;run, batchPause.bat, A_ScriptDir,, Pid ; run and catch Pid
;WinWait, % Title:= "ahk_pid" Pid,, 30
SetTimer, WatchCmd, 300
Gosub CheckFocus
WinActivate, % Title
WinWaitActive, % Title,, 30
Gosub CheckFocus
Sleep, 5000 ; try perssing any key twice before 5 Seconds run off
;Send, y ; here "y" terminates timeout
Gosub CheckFocus
ControlSend,, y, % Title ; alternative that works even if cmd is not active
Gosub CheckFocus
sleep, 3000 ; incresed only one can read cmd
;Send, {Enter} ; here "Enter" terminates cmd
Gosub CheckFocus
ControlSend,, {Enter}, % Title ; alternative that works even if cmd is not active
Gosub CheckFocus
SetTimer WatchCmd, ON ; just for this test
Gosub CheckFocus

Gosub CheckFocus
Sleep, 5000
Gosub CheckFocus
WinWait, % Title:= "Steam Login ahk_exe Steam.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30

Gosub CheckFocus
Send, 'my password for steam'
Gosub CheckFocus
sleep, 300
Gosub CheckFocus
Send, {Enter}
Gosub CheckFocus

Gosub CheckFocus
run "" "steam://rungameid/601150"
Sleep /t 30
Gosub CheckFocus
run /min "" "DMCVTrainer.exe"         ;script is in same location so no need for pathnames;
Gosub CheckFocus
run /min "" "SSSiyanCollabTU5.CT             ;script is in same location so no need for pathnames;
Gosub CheckFocus

Gosub CheckFocus
for /f "tokens=*" %%f in ('wmic cpu get NumberOfCores /value ^| find "="') do set %%f
GetNumberOfCores.cmd
Gosub CheckFocus

Gosub CheckFocus
Restart:
:: starting and assigning your process(es)
set "process_name=DevilMayCry5.exe"
Gosub CheckFocus

Gosub CheckFocus
Sleep /t 1
Gosub CheckFocus

Gosub CheckFocus
::remove .exe suffix if there is
set pn=%process_name:.exe=%
Gosub CheckFocus

Gosub CheckFocus
setlocal enableDelayedExpansion
Gosub CheckFocus

Gosub CheckFocus
:: this is threshold for 10% (percent)
set /a threshold=3
Gosub CheckFocus

Gosub CheckFocus
:CheckCpuLoad
set /a counter=0
:: getting three snapshots of CPU usage of the given process
for /f skip^=2^ tokens^=3^ delims^=^" %%p in ('typeperf "\Process(%pn%)\%% Processor Time"  -sc 3') do (
    set /a counter=counter+1
rem     for /f "tokens=1,2 delims=." %%a in ("%%p") do set "process_snapshot_!counter!=%%a%%b"
    for /f "tokens=1,2" %%a in ("%%p") do set "process_snapshot_!counter!=%%a"
)
Gosub CheckFocus

Gosub CheckFocus
:: convert to percentage
set /a process_snapshot_1/= %NumberOfCores%
set /a process_snapshot_2/= %NumberOfCores%
set /a process_snapshot_3/= %NumberOfCores%
Gosub CheckFocus

Gosub CheckFocus
:: comment three lines below when threshold is set correctly
@echo %process_snapshot_1%
@echo %process_snapshot_2%
@echo %process_snapshot_3%
Gosub CheckFocus

Gosub CheckFocus
Sleep /t 1
Gosub CheckFocus

Gosub CheckFocus
rem I modified below condition check since I don't fathom the original one!
:: if all three snapshots are less than 0000010 (now threshold) process will be killed
if %process_snapshot_1% LSS %threshold% if %process_snapshot_2% LSS %threshold% if %process_snapshot_3% LSS %threshold% (
     tskill %pn%
     taskkill /F /T /IM %process_name%
) & goto RUNNING
Gosub CheckFocus

Gosub CheckFocus
Sleep /t 1
GOTO CheckCpuLoad
Gosub CheckFocus


CheckFocus:
    while !WinActive("ahk_pid" Pid) ; if app looses focus the script will sleep, and continue after regaining the focus
        sleep, 100

WatchCmd:
    if !WinExist("ahk_pid " Pid) { ; you can replace "WinExist" with "WinActive" if you like
    ;if !WinActive("ahk_pid " Pid) {
        WinWaitClose, % TitleToClose:= "ahk_exe Devil May Cry 5.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe cheatengine-x86_64.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe DMCVTrainer.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe Steam.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe Werfault.exe" ; guessing game you want to exit
        ExitApp ; alternative for reload below:r
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 13:12

You didn't listen. You attempted to write the whole script. Did you try to execute it? Does it work? I'm sure not!

What is in Devil May Cry 5_steamlaunch_batch_mode_.bat?

Every label must be concluded with return e.g.:

Code: Select all

CheckFocus:
    while !WinActive("ahk_pid" Pid) ; if app looses focus the script will sleep, and continue after regaining the focus
        sleep, 100
return
Besides you have to conclude the script's main code with return too! E.g.:

Code: Select all

;First line of Code
;...
;Last line of Code
return

Label1:
;..
return

Label2:
;..
return

O.k. You did not translate Batch commands but that can be done later.

Does script work until the first of that included Batch commands? To test it just truncate the script.
Here is my attempt.

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases. 
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

CoordMode, Mouse, Client
run, Devil May Cry 5_steamlaunch_batch_mode_.bat, D:\Games\Steam,, Pid ; run and catch Pid
WinWait, % Title:= "ahk_pid" Pid,, 30

SetTimer, WatchCmd, 300
Gosub CheckFocus
WinActivate, % Title
WinWaitActive, % Title,, 30

Gosub CheckFocus
ControlSend,, y, % Title 

Gosub CheckFocus
ControlSend,, {Enter}, % Title 

Gosub CheckFocus
WinWait, % Title:= "Steam Login ahk_exe Steam.exe",, 30
WinActivate, % Title
WinWaitActive, % Title,, 30

Gosub CheckFocus
Send, 'my password for steam'
sleep, 300

Gosub CheckFocus
Send, {Enter}

; truncated the script to test it until here!
Return

CheckFocus:
    while !WinActive("ahk_pid" Pid) ; if app looses focus the script will sleep, and continue after regaining the focus
        sleep, 100
Return

WatchCmd:
    if !WinExist("ahk_pid " Pid) { ; you can replace "WinExist" with "WinActive" if you like
    ;if !WinActive("ahk_pid " Pid) {
        WinWaitClose, % TitleToClose:= "ahk_exe Devil May Cry 5.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe cheatengine-x86_64.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe DMCVTrainer.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe Steam.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe Werfault.exe" ; guessing game you want to exit
        ExitApp ; alternative for reload below:r
Return
If it doesn't work as expected, truncate the script futher block by block (blocks are separated with blank line) until it work as expected! Then report!
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 13:28

rommmcek wrote:
03 Jun 2020, 13:12
O.k. You did not translate Batch commands but that can be done later.
Oh, you did, but you took my advice literally, come on you know how to use run command e.g.:

Code: Select all

; start /min "" "DMCVTrainer.exe" - goes to:
run DMCVTrainer.exe,, Min
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 13:35

While on forum you can click on any command to get help!
Attachments
Help.png
Help.png (12.24 KiB) Viewed 3306 times
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 13:42

rommmcek wrote:
03 Jun 2020, 13:28
rommmcek wrote:
03 Jun 2020, 13:12
O.k. You did not translate Batch commands but that can be done later.
Oh, you did, but you took my advice literally, come on you know how to use run command e.g.:

Code: Select all

; start /min "" "DMCVTrainer.exe" - goes to:
run DMCVTrainer.exe,, Min
lols , i did tehe
rommmcek wrote:While on forum you can click on any command to get help!
did not know that function exists...cool beans , ok lemme check this out and see how far i can get on my own , not too optimistic but ill give it a whirl


p.s i didnt try to execute said script , was busy editing the shit out of it first , but im about to and i think im gona start with trying out your truncated script and go from there , even tho you aint running said scripts ...theyre usually point on unlike my attempts that are as can be seen a nightmare and a half :crazy:
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 14:23

well your truncated script throws a error unknown { in

Code: Select all

    if !WinExist("ahk_pid " Pid) { ; you can replace "WinExist" with "WinActive" if you like
removed said symbol allows script to launch , but it wont continue script once steam.exe aka the launcher gets focus , easy example while the launcher is loading up simply click on an explorer window or such to make it loose focus

so Gosub CheckFocus isnt really doing anything , or you gotta specify for what exe Gosub CheckFocus should stop the scripts further execution until it regains focus on said exe aka steam.exe in this instance
User avatar
tobsto occupied
Posts: 186
Joined: 20 Feb 2020, 09:34
Contact:

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 14:26

rommmcek wrote:
03 Jun 2020, 14:13
What is in Devil May Cry 5_steamlaunch_batch_mode_.bat?
its a batch to add dmc5 to steam, lols

Code: Select all

:: Get DLC Info from SteamDB by Sak32009 v3.8.1 | 2016 - 2019
:: Format: GreenLuma Reborn v1.7.3 [BATCH MODE]
:: AppID: 601150
:: AppID Name: Devil May Cry 5
:: AppID Total DLCs: 28
:: SteamDB: https://steamdb.info/app/601150
:: Homepage: https://github.com/Sak32009/GetDLCInfoFromSteamDB/
:: Support: http://cs.rin.ru/forum/viewtopic.php?f=10&t=71837

@ECHO OFF

:: WINDOWS WORKING DIR BUG WORKAROUND
CD /D "%~dp0"

:: CHECK APPLIST DIR
IF EXIST .\AppList RMDIR /S /Q .\AppList

:: CREATE APPLIST DIR
MKDIR .\AppList
:: CREATE DLCS FILES FOR __Devil May Cry 5__
ECHO 601150> .\AppList\0.txt
::Devil May Cry 5 - Alt Hero Colors
ECHO 940500> .\AppList\1.txt
::Devil May Cry 5 - Alt Heroine Colors
ECHO 940501> .\AppList\2.txt
::Devil May Cry 5 - Alt Style Rank Announcers
ECHO 941950> .\AppList\3.txt
::Devil May Cry 5 - Alt Title Calls
ECHO 941951> .\AppList\4.txt
::Devil May Cry 5 - Live Action Cutscenes
ECHO 941952> .\AppList\5.txt
::Devil May Cry 5 - DMC1 Battle Track 3-Pack
ECHO 941953> .\AppList\6.txt
::Devil May Cry 5 - DMC2 Battle Track 3-Pack
ECHO 941954> .\AppList\7.txt
::Devil May Cry 5 - DMC3 Battle Track 3-Pack
ECHO 941955> .\AppList\8.txt
::Devil May Cry 5 - DMC4 Battle Track 3-Pack
ECHO 941956> .\AppList\9.txt
::Devil May Cry 5 - Gerbera GP01
ECHO 941957> .\AppList\10.txt
::Devil May Cry 5 - Pasta Breaker
ECHO 941958> .\AppList\11.txt
::Devil May Cry 5 - Sweet Surrender
ECHO 941959> .\AppList\12.txt
::Devil May Cry 5 - Mega Buster
ECHO 941960> .\AppList\13.txt
::Devil May Cry 5 - Cavaliere R
ECHO 941961> .\AppList\14.txt
::Devil May Cry 5 - Monkey Business
ECHO 941965> .\AppList\18.txt
::Devil May Cry 5 - 100000 Red Orbs
ECHO 941969> .\AppList\22.txt
::Devil May Cry 5 - 200000 Red Orbs
ECHO 941970> .\AppList\23.txt
::Devil May Cry 5 - 300000 Red Orbs
ECHO 941971> .\AppList\24.txt
::Devil May Cry 5 - 500000 Red Orbs
ECHO 941972> .\AppList\25.txt
::Devil May Cry 5 - 1000000 Red Orbs
ECHO 941973> .\AppList\26.txt
::Devil May Cry 5 - Wallpaper
ECHO 945600> .\AppList\27.txt
::Devil May Cry 5 Original Soundtrack
ECHO 1050460> .\AppList\28.txt

:: START GREENLUMA REBORN
IF EXIST .\DLLInjector.exe GOTO :Q
GOTO :EXIT

:Q
SET /P c=Do you want to start GreenLuma Reborn [Y/N]?
IF /I "%c%" EQU "Y" GOTO :START
IF /I "%c%" EQU "N" GOTO :EXIT
GOTO :Q

:START
CLS
ECHO Launching Greenluma Reborn - APPID 601150 - APPNAME Devil May Cry 5
TASKKILL /F /IM steam.exe
TIMEOUT /T 2
DLLInjector.exe -DisablePreferSystem32Images

:EXIT
EXIT

toldcha theres a reason why one batch will always be left in requirements, so i just have to plugin whatever additional batch thats until the guy that makes said batches converts over to ahk,lols 8-)

all this boiling down to me needing your actual help , hence why ive been saying since beginning this coding stuff isnt my cup of tea , im just a fucking gamer that wants ease of access with problem solution thats all , do appreciate you trying to teach me tho , but im just stupid as a bag of rocks when it comes to code anything, i can test out stuff tho and give feedback till it does work, im what you call an apply and test kinda guy not an author :thumbup:
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Request for a script that autostops commands etc. on app focus loss and continue on refocus from where it left off

03 Jun 2020, 15:21

Correct is:

Code: Select all

WatchCmd:
    if !WinExist("ahk_pid " Pid) { ; you can replace "WinExist" with "WinActive" if you like
    ;if !WinActive("ahk_pid " Pid) {
        WinWaitClose, % TitleToClose:= "ahk_exe Devil May Cry 5.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe cheatengine-x86_64.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe DMCVTrainer.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe Steam.exe" ; guessing game you want to exit
        WinClose, % TitleToClose:= "ahk_exe Werfault.exe" ; guessing game you want to exit
        ExitApp ; alternative for reload below:r
   }
Return
I mean Syntax is correct like this, however it doesn't mean the code will do what you want. It will do:

If process with that Pid don't exist it will close 5 other processes and exit (the whole ahk script will exit)!

Is that what you want? Probably not, so change it to do what you want!
Last edited by rommmcek on 03 Jun 2020, 16:08, edited 1 time in total.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 55 guests