Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


To close the game, is there any other lua code?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sat Jan 16, 2021 10:41 am    Post subject: To close the game, is there any other lua code? Reply with quote

I did some research and tried what I found.
DB suggested as follows; See the correct name of the game with "Windows Logo + R".
I tried it and verified the game name.
I saw it listed with the same name in the CE transaction list.
It is listed with the same name in the task list.
But the code below does not close the game.
Any other suggestions?

Process List;
00001594-Game One.exe

Task Manager List;
Game One (PID:5524)

Windows + R path;
"C:\Program Files\GameOne\Game One.exe"

Kill code;
os.execute("taskkill /F /IM Game One.exe")

Open code;
os.execute([["C:\Program Files\GameOne\Game One.exe"]])
os.execute("taskkill /F /IM cmd.exe")

And the program doesn't close with this code.

os.execute("taskkill /F /IM Game One.exe")
(It shuts down manually from the task manager.)

The same code is closing other apps.
What other way can I try?
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Sat Jan 16, 2021 11:50 am    Post subject: This post has 1 review(s) Reply with quote

You're not escaping the space in the name. It's like you're passing the word "Game" to the "/im" option, and a separate parameter "One.exe" that taskkill doesn't do anything with.
Code:
os.execute'taskkill /im "Game One.exe"'

If you can easily get the pid, that would be better.
Code:
os.execute'taskkill /pid 5524'

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Sat Jan 16, 2021 1:07 pm    Post subject: Reply with quote

ParkourPenguin wrote:
You're not escaping the space in the name. It's like you're passing the word "Game" to the "/im" option, and a separate parameter "One.exe" that taskkill doesn't do anything with.
Code:
os.execute'taskkill /im "Game One.exe"'

If you can easily get the pid, that would be better.
Code:
os.execute'taskkill /pid 5524'



https://stackoverflow.com/a/2055814

Thanks .. We found this solution at the same time.
If I couldn't find it anyway, your answer is life-savingly gratifying.
+1 includes this answer, thank you.

here is the code for those who follow;

Code:
local procesID = getProcessIDFromProcessName("Game One.exe")

--print(procesID)

os.execute("taskkill /pid "..procesID)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites