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 


CRDR - CE Text Manager / Text Finder

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Jun 12, 2019 10:53 pm    Post subject: CRDR - CE Text Manager / Text Finder This post has 1 review(s) Reply with quote

In relation to these topics:

https://forum.cheatengine.org/viewtopic.php?t=610292
https://forum.cheatengine.org/viewtopic.php?t=610277

This is a text finder/text manager I have provided.

Code:
f=createForm()
f.setSize(550,550)
f.Position='poScreenCenter'
f.BorderStyle='bsSingle'
f.Color='7897995'
f.Caption='CRDR - CE Text Manager'
load_dialog = createOpenDialog(f)
save_dialog = createSaveDialog(f)

textbox=createEdit(f)
textbox.setPosition(5,5)
textbox.Autosize=false
textbox.setSize(280,28)
textbox.Font.Size=10
textbox.Color='13495295'
textbox.Text=""

searchButton=createButton(f)
searchButton.setPosition(textbox.Left+textbox.Width+10,5)
searchButton.setSize(80,27)
searchButton.Caption='Search Text'

lineButton=createButton(f)
lineButton.setPosition(searchButton.Left+searchButton.Width+5,5)
lineButton.setSize(80,27)
lineButton.Caption='Get Line'

openButton=createButton(f)
openButton.setPosition(lineButton.Left+lineButton.Width+5,5)
openButton.setSize(80,27)
openButton.Caption='Open File'

memo1=createMemo(f)
memo1.setPosition(5,textbox.Top+textbox.Height+10)
memo1.setSize(540,220)
memo1.BorderStyle='bsSingle'
memo1.HideSelection=false
memo1.WordWrap=false
memo1.ScrollBars='ssAutoBoth'
memo1.Color='13495295'
memo1.Font.Size = 10

memo2=createMemo(f)
memo2.setPosition(5,memo1.Top+memo1.Height+10)
memo2.setSize(540,220)
memo2.BorderStyle='bsSingle'
memo2.HideSelection=false
memo2.WordWrap=false
memo2.ScrollBars='ssAutoBoth'
memo2.Color='13495295'
memo2.Font.Size = 10

infoButton=createButton(f)
infoButton.setPosition(5,memo2.Top+memo2.Height+10)
infoButton.setSize(100,27)
infoButton.Caption='Get Info'

glosButton=createButton(f)
glosButton.setPosition(110,memo2.Top+memo2.Height+10)
glosButton.setSize(100,27)
glosButton.Caption='Glossary'

resetButton=createButton(f)
resetButton.setPosition(215,memo2.Top+memo2.Height+10)
resetButton.setSize(100,27)
resetButton.Caption='Reset'

saveButton=createButton(f)
saveButton.setPosition(445,memo2.Top+memo2.Height+10)
saveButton.setSize(100,27)
saveButton.Caption='Save Changes'

--------------------------------------------------------------------------------
local texture = [[
This is a dummy text for test all functions on this tool.
---------------------------------------------------------
cheat engine is a tool use to hack an app.
people mostly used cheat engine for hacking a game.
cheat engine is possible to manage memory such as
editing (reading and writing).
cheat engine made by Dark Byte a.k.a Eric henen.
cheat engine or CE, is an open-source
memory scanner/hex editor/debugger.
The first version of cheat engine has release at
June 28 2000 version 1.3 source code.
---------------------------------------------------------
]]

function init()
 memo1.Clear()
 memo1.Lines.Text = texture
 if memo1.Lines.Text == "" then
 infoButton.Enabled = false
 saveButton.Enabled = false
 else
 infoButton.Enabled = true
 saveButton.Enabled = true
 end
end

function charCount()
 cnt = memo1.Lines.Count-1
 s = memo1.Lines.Text
 c = string.len(s)
 _,n = s:gsub("%S+","")
 sumL = s:gsub("%s+", "")
 sumL = string.gsub(s, "%s+", "")
 str=string.len(sumL)
 whitespace = c - str
 info1 = 'Total Characters :   '..c..'   (including whitespace : '..whitespace..' )'
 info2 = 'Total Words :   '..n
 info3 = 'Total Lines :   '..cnt..'   (starting from line 0)'
 memo2.Clear()
 memo2.Lines.Add(info1)
 memo2.Lines.Add(info2)
 memo2.Lines.Add(info3)
end
infoButton.OnClick=charCount

function glsry()
 memo2.Clear()
 local sl = createStringList()
 local content = memo1.Lines.Text
 local wrd
 local words = {}
 local lines = {}
 local line_count = -1
 for l in content:gmatch("[^\n]+") do
 line_count = line_count + 1
 for w in l:gmatch("[^%s%p]+") do
 w = w:lower()
 words[w] = words[w] and words[w] + 1 or 1
 lines[w] = lines[w] or {}
 if lines[w][#lines[w]] ~= line_count then
 lines[w][#lines[w] + 1] = line_count
 end
 end
 end
 for w, count in pairs(words) do
 local the_lines = ""
 for _,line in ipairs(lines[w]) do
 the_lines = the_lines .. line .. ' / '
 end
 if count>1 then wrd = "words" else wrd = "word" end
 --print(w .." = " .. count .. " words , lines " .. the_lines)
 --memo2.Lines.Add(w .." = " .. count .. " ".. wrd .. "     [ lines : /  " .. the_lines .." ]")
 sl.Add(w .." = " .. count .. " ".. wrd .. "     [ lines : /  " .. the_lines .." ]")
 end
 sl.sorted = true
 for i=0, sl.Count-1 do
 memo2.Lines.Add(sl[i])
 end
 sl.destroy()
end
glosButton.OnClick=glsry

function getline()
 local m = textbox.Text
 local counter = memo1.Lines.Count-1
 if tonumber(m) ~= nil then
 m = tonumber(m)
 if m > counter then
 showMessage('Line number out of range. Max. Lines = '..counter)
 return
 end
 --memo2.Clear()
 memo2.Lines.Add('Line '..m..' : '..memo1.Lines[m])
 else
 showMessage('Please input line number..')
 return
 end
end
lineButton.OnClick=getline

function search(code,term)
 --memo2.Clear()
 code = memo1.Lines.Text
 term = textbox.Text
 if term == "" then
 showMessage("Please input words/characters to be search..")
 return nil
 end
 local n=0
 code="\n"..code
 code=code:gsub("\n", function () n=n+1 return "\n@"..n..":" end)
 memo2.Lines.Add('Search result for ['..term..'] found at :')
 memo2.Lines.Add('-------------------------------------------------------------')
 for a,b in code:gmatch("@(%d+):([^\n]-"..term.."[^\n]-)\n") do
 -- print('Line '..a..' : '..b)
 a = math.floor(a - 1)
 memo2.Lines.Add('Line '..a..' : '..b)
 end
 memo2.Lines.Add('=============================================================')
end
searchButton.OnClick = search

function reseter()
 memo2.Clear()
 textbox.Text = ""
end
resetButton.OnClick = reseter

local open = io.open
local function read_file(path)
 local file = open(path, "rb")
 if not file then
 showMessage("Error - can't read file content!")
 return nil
 end
 local content = file:read "*a"
 file:close()
 return content
end

function loadtext()
 load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.Filter = 'Text files|*.TXT;*.txt|All files (*.*)|*'
 load_dialog.execute()
 local file = load_dialog.FileName
 local fileContent = read_file(file)
 memo1.Clear()
 memo1.Lines.Text = fileContent
end
openButton.OnClick = loadtext

function savechange()
 --local defaultpath = TrainerOrigin or getMainForm().SaveDialog1.InitialDir
 save_dialog.InitalDir = os.getenv('%USERPROFILE%')
 save_dialog.Filter = 'Text files|*.TXT;*.txt|All files (*.*)|*'
 save_dialog.execute()
 local file = save_dialog.FileName
 local fname = file
 contents = memo1.Lines.Text
 local file,err = io.open(file,'w')
 if file then
  file:write(contents)
  file:close()
  showMessage('Changed data has been saved on '..fname)
 else
  showMessage("error:", err)
 end
end
saveButton.OnClick = savechange

function closer()
 closeCE()
 return caFree
end
f.onClose = closer
--------------------------------------------------------------------------------
f.show()
init()


Copy those code to your CE Lua Table Script and save as a CT file. Or CETRAINER/EXE file (if you are very very super care your code will be stolen).

Demo Video:

https://youtu.be/u9XuSfIYRIc


Need to do:
- Add a function to read/open a text file from a URL
- Handle Unicode/UTF-16 texts or Non-Latin Windows Codepage



CRDR Text Finder.JPG
 Description:
 Filesize:  78.42 KB
 Viewed:  16403 Time(s)

CRDR Text Finder.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1227

PostPosted: Thu Jun 13, 2019 6:15 am    Post subject: Reply with quote

Your attention to detail is admirable.
Search result: must contain rows and subsequent rows.
Not only the word, but also the lines below the word.

Search: a.k.a

result:
Search result for [a.k.a] found at :
Line 7 :
------------------------------------------
a.k.a Eric henen.
cheat engine or CE, is an open-source
memory scanner/hex editor/debugger.
etc
etc
etc


Is it possible?
Thanks again for this work.

_________________
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
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Thu Jun 13, 2019 7:04 am    Post subject: Reply with quote

Your welcome, of course, that is possible. With this logic, after parsing all lines containing the searched word, then do a parsing process again using string.match and then display the results in memo2. How to do that?.
Try googling "Parsing/split specific word from text using Lua".

And I think I did it on my project above by a function on 'Glossary' button.

But if you must then just change this code:

Line 191: from

Code:
memo2.Lines.Add('Line '..a..' : '..b)


change to:

Code:
memo2.Lines.Add('Line '..a..' : '..term)


Enjoy!

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 30

Joined: 16 Feb 2017
Posts: 1227

PostPosted: Thu Jun 13, 2019 6:08 pm    Post subject: Reply with quote

For now, I will use it.
Line search yields limited results. Sad
( But for you, it provided a new project sharing. Smile )
All files and folders with archiving,
Able to write and install again.


video: https://www.youtube.com/watch?v=fMCg7ni5UEU&feature=youtu.be

_________________
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
danrevella
Master Cheater
Reputation: 2

Joined: 11 Jun 2008
Posts: 290

PostPosted: Wed Apr 08, 2020 2:38 pm    Post subject: Reply with quote

Please excuse, anyone does have got this very first relase version of Cheat Engine 1.3 year 2000 ?
Many thanks!!!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Wed Apr 08, 2020 3:03 pm    Post subject: Reply with quote

that is off-topic, but the sourcecode (delphi 2) is here: http://cheatengine.org/download/Cheatengine1.3.RAR
_________________
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
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Extensions 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