View previous topic :: View next topic |
Author |
Message |
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Thu Jul 22, 2021 1:13 am Post subject: getting trainer path with name |
|
|
how do i get the current trainer path with its name? i know you can get the directory with TrainerOrigin but i also want to get the trainer name.
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Thu Jul 22, 2021 2:51 am Post subject: |
|
|
Code: |
return (TrainerOrigin or getCheatEngineDir()) .. enumModules(getCheatEngineProcessID())[1].Name
|
_________________
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 |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Thu Jul 22, 2021 4:09 am Post subject: |
|
|
everytime i use it i only get cheatengine-x86_64-SSE4-AVX2.exe, is there no other way to get the current trainer/ct's file name? e.g. Test.CT or etc.
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Thu Jul 22, 2021 11:11 am Post subject: |
|
|
mgr.inz.Player wrote: |
--( https://forum.cheatengine.org/viewtopic.php?t=593741 )
Code: | local mf = getMainForm()
local sd = mf.SaveDialog1
local od = mf.OpenDialog1
local filefullpath
local filename
local mi
local function returnFileName(path)
--extracts file name from full path (not full path => return nil)
return (path~=nil) and (path:match("\\([^\\]+)$"))
end
if filename then currentTableNameLabel.Caption = 'CT Name: '..filename
else currentTableNameLabel.Caption = 'CT Name:' end
|
|
In your case the code could be used like this;
(We assume that you will save the Trainer or ".CT" at least once and use it in the registered table)
Code: | function FileName(opsion)
local filename=""
opsion=tonumber(opsion)
mf = getMainForm()
local sd = mf.SaveDialog1
local od = mf.OpenDialog1
local function returnFileName(path)
return (path~=nil) and (path:match("\\([^\\]+)$"))
end
filefullpath = sd.Filename or od.Filename or ''
if opsion==1 then filename = filefullpath
else
filename = returnFileName(filefullpath)
end
return filename
end
local CTName=FileName(1) --full path + name
print(CTName)
local CTName1=FileName(2) --name
print(CTName1) |
|
|
Back to top |
|
|
HexaG0n Advanced Cheater Reputation: 0
Joined: 29 Mar 2021 Posts: 64
|
Posted: Fri Jul 23, 2021 1:10 am Post subject: |
|
|
thank you so much ByTransient, this is exactly what im looking for!
edit: when i open the ct, for some reason it doesnt give me the path name unless i execute the script again. am i doing something wrong?
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Fri Jul 23, 2021 4:23 am Post subject: |
|
|
HexaG0n wrote: |
edit: for some reason it doesnt give me the path name unless i execute the script again. |
Codes don't work without a trigger or run.
If I did not make a wrong translation, I can answer the problem with 1 solution. But this path will be resolved in CE Autorun folder, not in CT file.
You can browse @mgr.inz.Player's code and paste the plugin into CE>>Autorun folder. So when you open the CT, you can always see the CT name above the "Found list" on the CE Main Form.
( https://forum.cheatengine.org/viewtopic.php?t=593741 )
However, I don't understand why you want to know the CT file that you already know the name and opened.
If you are considering using this code in Trainer, I can give you better idea.
|
|
Back to top |
|
|
|