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 


How to make .NFO file open through Trainer?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
Death GOD 7
Expert Cheater
Reputation: 0

Joined: 21 Jan 2017
Posts: 105
Location: Heaven and Hell

PostPosted: Fri Feb 02, 2018 10:05 am    Post subject: How to make .NFO file open through Trainer? Reply with quote

I was wondering if it is possible to open nfo file through trainer (like from a About button)
I already have made .nfo file of the trainer note and everything just need them to open like other people have(in patch, crack, etc)
Any help?

_________________

"If you are good at something,never do it for free"-The Joker
I know you are looking at this post, Hitler
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Fri Feb 02, 2018 11:05 am    Post subject: Reply with quote

I imagine you can just pass the filepath to shellExecute like you would for a url and have the OS handle opening it with the default program... untested however.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Fri Feb 02, 2018 11:16 am    Post subject: Reply with quote

if the .nfo is inside the .EXE use the getCheatEngineDir() function to get the path to the extracted CE folder

if the .nfo is next to the .EXE use the TrainerOrigin variable to get the path to the .exe trainer

once you have the path you can do something like:
Code:

shellExecute('notepad', pathtofile)



--

if it's inside the table itself, use a form with a memory field, just put the contents of the .nfo in there and show that

_________________
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
Death GOD 7
Expert Cheater
Reputation: 0

Joined: 21 Jan 2017
Posts: 105
Location: Heaven and Hell

PostPosted: Thu Feb 08, 2018 10:39 pm    Post subject: Reply with quote

FreeER wrote:
I imagine you can just pass the filepath to shellExecute like you would for a url and have the OS handle opening it with the default program... untested however.

Dark Byte wrote:

use the getCheatEngineDir() function to get the path to the extracted CE folder

Code:

shellExecute('notepad', pathtofile)


Thanks for replying and is this code correct?
Code:

a = getCheatEngineDir(trainerprocess.exe)

Then what do i put in shellExecute? You have said pathfile can you show example of it? Very Happy

i got that info from wiki .i dont know much but as i look at DB's code I know that the file will be executed with notepad(which looks like edited text) is there some other app/plugin that can just open nfo file? as read only

_________________

"If you are good at something,never do it for free"-The Joker
I know you are looking at this post, Hitler
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Thu Feb 08, 2018 11:20 pm    Post subject: Reply with quote

getCheatEngineDir doesn't take any arguments it simply returns where the real trainer files got extracted to (the EXE CE generates is essentially a self-extracting archive containing the actual exe trainer and the files it needs to run)

Quote:
what do i put in shellExecute?
shellExecute('notepad', the path to the file)

a simple test of

Code:
local cepath = getCheatEngineDir()
print(cepath)
local filepath = cepath .. 'test.nfo'
print(filepath)


gets you something like
C:\Users\<username>\AppData\Local\Temp\cetrainers\CETB9EE.tmp\extracted\
C:\Users\<username>\AppData\Local\Temp\cetrainers\CETB9EE.tmp\extracted\test.nfo

so now you have the path to the file and you know what to do with it right? yeah, pass it to shellExecute

shellExecute('notepad', filepath)

of course, you'd take out the prints once you're done testing. Just make sure you actually add the file when you generate the trainer or it won't exist Smile


as for other programs... not sure of anything that you can be confident of existing... maybe run cmd with the type command... something like shellExecute('cmd', ('/c type "%s" & pause'):format(filepath)), of course you could just show a form with a readonly (and probably scrollable) "memo" displaying the contents eg ( https://github.com/FreeER/CE-Examples/tree/master/LoadingFiles )

Code:
local cepath = getCheatEngineDir()
local filepath = cepath .. 'test.nfo'

local f = io.open(filepath, 'r')
CETrainer.CEMemo1.Lines.Text = f:read('*all')
f:close()
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1227

PostPosted: Fri Feb 16, 2018 11:25 pm    Post subject: Reply with quote

Store / write the data in the cetriner.
then give him a record file path.
then recall it with a recall / button!

Code:

function getTrainerRealPath1()
local t
t= os.getenv("Temp") .. "\\cetrainers";
return t
end
function SaveSettings()
if MyPath then
settingsFile = os.rename(MyPath.."\\File.txt",MyPath.."\\Info_File.txt")
if (settingsFile == nil) then
settingsFil = io.open(MyPath.."\\Info_File.txt", "a+")
settingsFil:write(info_files)
control_setCaption(UDF1_CEMemo1, info_file)
info_file=info_files
settingsFil:close()
end
MyLoadSettings()
end
end
function MyLoadSettings(sender)
if MyPath then
settingsFile = io.open(MyPath.."\\Info.txt", "r+")
if (settingsFile ~= nil) then
new_files=settingsFile:read("*all")
control_setCaption(UDF1_CEMemo1, settingsFile:read("*all"))
settingsFile:close()
control_setCaption(UDF1_CEMemo1, info)
end
end
end
function MySaveSettings()
if MyPath then
string= control_getCaption(UDF1_CEEdit1)
if ( string == "" ) then
messageDialog( "bla..bla..", 4, 2 );
MyLoadSettings()
return false
end


Correction is possible in this code. you are the master. Smile

--------------
https://www.dropbox.com/s/851nodtc2ielqr5/By-KARAHANLI-Music.CT?dl=0
Listen to some music. but 4 songs 105MB!
Please find a solution to this .xm format.
.midi formatio is very convenient! Rolling Eyes

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat Feb 17, 2018 9:57 am    Post subject: Reply with quote

Yeah you can write the file with lua's file handling utilities and then follow the same steps as above to open it

@Aylin purely because you named the functions with the word "Settings" which would presumably be user changeable (at least within the trainer) I wouldn't suggest using the cetrainers folder for 2 reasons

1. It's in the temp directory so it'll presumably be deleted at some point, possibly before the user is done using the trainer. It'd probably be annoying to set things up the way you wanted and then have all your settings lost because windows decided to free up some space or they ran ccleaner etc.
2. If it's possible for any settings to break the trainer (invalid resolution, filepaths, etc.) then the user may not know how to find the settings file to delete it and get back to the defaults if it's off in the temp directory. If you use TrainerOrigin then it'll be created right next to the trainer executable that the user clicks on to launch it.

As for getTrainerRealPath1 just be aware that someone could create a custom version of CE that uses a different folder and breaks this (perhaps there's some anticheat out there that creates that folder and makes it read only or checks for exes launched out of it) Smile
Just something to be aware of when you choose to hardcode things instead of using given functions. Same applies to the code I wrote since it depends on "cetrainers" but I know that I was aware of it at the time so Smile

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
PrometheusPB
How do I cheat?
Reputation: 0

Joined: 01 Apr 2018
Posts: 5

PostPosted: Tue Apr 03, 2018 11:11 pm    Post subject: Saw your sig calling me out Reply with quote

Okay Death God 7, so you know me, but I don't know you. Which one of the select sarcastic few on earth who know me are you? I can't PM you yet Lame , so reveal yourself to me before I have to go and make another post at you Razz
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 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