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 get opened document file path ?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
hikaru7777
How do I cheat?
Reputation: 0

Joined: 15 Nov 2020
Posts: 0

PostPosted: Sat Nov 21, 2020 3:30 pm    Post subject: How to get opened document file path ? Reply with quote

I want to get the path of currently open file with text editor gPad.
In Notepad and Paint, I searched that file path and pointer scan of the address where the file path was stored.
Then I added the offset address to the base address, and called ReadProcessMemory to get the file path. It worked well.

But In WinMerge, Acrobat Reader and gpad, It does NOT work.
There is no address of active tab file path.
I don't know why.

Plz, teach me the method to get active tab file path.

Sorry for poor English.

Thank you for help!!
Back to top
View user's profile Send private message AIM Address
avangers
Newbie cheater
Reputation: 0

Joined: 20 Sep 2017
Posts: 18

PostPosted: Sat Dec 05, 2020 5:01 am    Post subject: Reply with quote

Maybe this helps because I searched for you the whole forum to help you solve the error you got. This post is from @Corroder his the script maker, so all fame go to him about the code functionality
Code:

local open = io.open
local function read_file(path,file)
    local file = open(file, "rb")
    if not file then return nil end
    local content = file:read "*a"
    file:close()
    return content
end

path = TrainerOrigin or getMainForm().OpenDialog1.InitialDir
path = Path..'\\'
local fileContent = read_file(path, 'Lynxz Gaming.txt')   --- change to filename you want to open and read
print(fileContent);


method 2 again created by @Corrodor
Code:

function GetFileName(f)
 local str = f
 local temp = ""
 local result = ""
 for i = str:len(), 1, -1 do
 if str:sub(i,i) ~= "/"  then
 temp = temp..str:sub(i,i)
 else
 break
 end
 end
 for j = temp:len(), 1, -1 do
 result = result..temp:sub(j,j)
 end
 return result
end

function getfile()
 load_dialog = createOpenDialog(self)
 load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.execute()
 file = load_dialog.FileName
 fl = GetFileName(file)
 if fl == nil then
 return file
 else
 local open = io.open
 local file2read = open(fl, "rb")
 local content = file2read:read "*a"
 file2read:close()
 print(content)
 return content
 end
end

getfile()


I hope this works fine for you, and if it doesn't, thank me alone for putting effort in searching it but give a big thanks to @Corroder. He is the Lua script maker
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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