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 


[Lua] Retrieve path of current attached process

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Wed Aug 04, 2021 9:14 am    Post subject: [Lua] Retrieve path of current attached process Reply with quote

Any help would be appreciated. I've tried:

Code:

extractFilePath(process)
extractFilePath('name_of_game')


Thanks in advance.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25291
Location: The netherlands

PostPosted: Wed Aug 04, 2021 10:29 am    Post subject: Reply with quote

Code:

enumModules()[1].PathToFile

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Wed Aug 04, 2021 10:40 am    Post subject: Reply with quote

Dark Byte wrote:
Code:

enumModules()[1].PathToFile


In addition (a bit dark, but it works)

Zanzer wrote:
Not sure I would trust someone trying to find my installation directory. Smile

Have fun...

local path = io.popen("PowerShell Get-Process -Id "..getOpenedProcessID().." ^| Format-List Path"):read("*all"):gsub("^%s*Path : (.-)%s*","%1");


process("cheatengine-x86_64.exe")
result:

C:\Program Files\Cheat Engine 7.2\cheatengine-x86_64.exe

EDIT:
DB's suggestion is more stable and does not require additional options (cmd blackout etc).

Thanks DarkByte, I'll add this to my code list.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

Joined: 02 Sep 2011
Posts: 1055
Location: 0x90

PostPosted: Wed Aug 04, 2021 10:53 am    Post subject: Reply with quote

@DB,
Thanks! Something so small yet had me scratching my head for a while.

@ByTransient,
Nevertheless, it's always good to have multiple ways of achieving the same result.

I learned some new tricks today Smile
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