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 


Replace Edit box with combobox in the Find/Replace windows?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Sat May 06, 2023 11:28 am    Post subject: Replace Edit box with combobox in the Find/Replace windows? Reply with quote

Is it possible to replace Edit box with combobox in the Find and Replace windows in the CE Cheat Table Lua script and Lua Engine? And make the combobox remember the last entered data. And as a result, the last entered data will be in the combobox.
If this is not possible with Lua code, then is it possible to just add a combobox to the Find and Replace windows and make the combobox remember the last entered data?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Sat May 06, 2023 1:01 pm    Post subject: Reply with quote

The control used for the find function is limited. It's possible you could code your own find function and assign it to the event upon clicking find in the menu. Not exactly what you want, but something to get you started in the right direction.
Code:

if f then f.destroy(); f = nil end

f = createForm(getMainForm())
f.Name = 'frmMain'
f.Caption = 'Main Form'
f.Width = 300
f.Height = 275
f.Position = 'poDesktopCenter'

t = createEdit(f)
t.Height = 30
t.Width = f.Width - 60
t.Left = 5
t.Top = 10
t.Name = 'txtFind'

b = createButton(f)
b.Name = 'btnFind'
b.Caption = 'Find'
b.Width = 50
b.Height = 25
b.Left = f.width - (b.Width + 3)
b.Top = 9
b.OnClick = function()
            local text = getLuaEngine().mScript.Text
            local searchText = f.t.Text
            if text and searchText then
               local start, textEnd = string.find(text, searchText)
               if start ~= nil then
                  local selectedText = string.sub(text, start, textEnd)
                  print(selectedText)
                  -- Code to select the text here
               end
            end
            end
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Sat May 06, 2023 2:51 pm    Post subject: Reply with quote

Basically, I want the search history from an edit box in the "Find" window from Cheat Table Lua script to be stored in a combo box that would be placed in the same "Find" window.
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Sat May 06, 2023 3:11 pm    Post subject: Reply with quote

Yes, you can customise the components as you see fit. See celua.txt

Ctrl + F > Type create.

It will locate all functions that relate to creating components.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Sun May 07, 2023 10:43 am    Post subject: This post has 1 review(s) Reply with quote

I guess you need something like:

Code:
if srchFrm1 then srchFrm1.Destroy() srchFrm1=nil end
DP1=getScreenDPI()/96
srchFrm1=createForm()
srchFrm1.height=70*DP1 srchFrm1.width=340*DP1 srchFrm1.left=283*DP1 srchFrm1.top=142*DP1
srchFrm1.PopupMode=0 srchFrm1.caption="Search Add Tbl"
srchFrm1.Position="poDesktopCenter" srchFrm1.BorderStyle="bsSingle"  srchFrm1.ShowInTaskBar="stAlways"
-------------------------
local sTbl1 = {}
----------------------- sTbl1.sB1 ----- 
sTbl1.sB1=createButton(srchFrm1)
sTbl1.sB1.AutoSize=false
sTbl1.sB1.height=25*DP1 sTbl1.sB1.width=120*DP1 sTbl1.sB1.left=210*DP1 sTbl1.sB1.top=9*DP1
sTbl1.sB1.caption="Search"
sTbl1.sB1.Font.Style="fsBold" sTbl1.sB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 ----- 
sTbl1.sB2=createButton(srchFrm1)
sTbl1.sB2.AutoSize=false
sTbl1.sB2.height=25*DP1 sTbl1.sB2.width=190*DP1 sTbl1.sB2.left=10*DP1 sTbl1.sB2.top=40*DP1
sTbl1.sB2.caption="Clear  Search  List"
sTbl1.sB2.Font.Style="fsBold" sTbl1.sB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB1 ----- 
sTbl1.sCB1=createComboBox(srchFrm1)
sTbl1.sCB1.AutoSize=true
sTbl1.sCB1.height=22*DP1 sTbl1.sCB1.width=190*DP1 sTbl1.sCB1.left=10*DP1 sTbl1.sCB1.top=10*DP1
sTbl1.sCB1.text=""
sTbl1.sCB1.Font.Style="fsBold" sTbl1.sCB1.Font.Size=10*DP1
--sTbl1.sCB1.ReadOnly=false sTbl1.sCB1.Style="csDropDown"
-----------------------
--============================================================================--
--============================================================================--
--============================================================================--

local srcTextTbl={}
local newText=""
local assList = MainForm.frmAutoInject.Assemblescreen
local line1 = 0

function clrTbl(tbl)
 for i,k in pairs(tbl) do
  tbl[i] = nil
 end
end

sTbl1.sB1.OnClick=function()
local check1 = 0
 if sTbl1.sCB1.text=="" then
  print("Please type a word in the search text box!")
 else
  newText=sTbl1.sCB1.text
 if string.find(assList.Lines.Text,newText) then
  for l,k in pairs(srcTextTbl) do
   if k==sTbl1.sCB1.text then check1=1 end
  end
  if check1==0 then
   srcTextTbl[#srcTextTbl + 1] = sTbl1.sCB1.text
   sTbl1.sCB1.Items.Add(sTbl1.sCB1.text)
  end
    r1,r2 = string.find(assList.Lines.Text,newText,line1)
   if r2~=nil then
    assList.SelStart=r1
    assList.SelEnd=r2 + 1
    assList.setFocus()
    line1=tonumber(line1) + r2 + 1
    r3,r4 = string.find(assList.Lines.Text,newText,line1)
     if r4==nil then line1=0 end
   end
   else
    showMessage("'"..newText.."'  not found!")
  end
 end
end

sTbl1.sB2.OnClick=function()
clrTbl(srcTextTbl)
  sTbl1.sCB1.clear()
end


An example to get started.

_________________
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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Sun May 07, 2023 12:24 pm    Post subject: Reply with quote

AylinCE wrote:
...


Nice work! Smile
Back to top
View user's profile Send private message
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Tue May 09, 2023 7:49 am    Post subject: Reply with quote

AylinCE wrote:
I guess you need something like:

Thanks for example. Do you know how to highlight all the same words in Lua script with green background color when one word is selected?
Back to top
View user's profile Send private message
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Tue May 09, 2023 10:08 am    Post subject: Reply with quote

Razi wrote:
Thanks for example. Do you know how to highlight all the same words in Lua script with green background color when one word is selected?


I'm pretty sure this isn't possible without modifying the actual source code of the component responsible for displaying the text.
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Tue May 09, 2023 1:05 pm    Post subject: Reply with quote

LeFiXER wrote:
Nice work! Smile


Thanks ..

Here is a different and slightly more comprehensive example:
*Search
*Copy
*Paste (Or Replace)
*Cut
I don't know if I should add a "Replace All" option.

Code:
if srchFrm1 then srchFrm1.Destroy() srchFrm1=nil end
DP1=getScreenDPI()/96
srchFrm1=createForm()
srchFrm1.height=130*DP1 srchFrm1.width=340*DP1 srchFrm1.left=283*DP1 srchFrm1.top=142*DP1
srchFrm1.PopupMode=0 srchFrm1.caption="Search Add Tbl"
srchFrm1.Position="poDesktopCenter" srchFrm1.BorderStyle="bsSingle"  srchFrm1.ShowInTaskBar="stAlways"
-------------------------
local sTbl1 = {}
----------------------- sTbl1.sB1 -----
sTbl1.sB1=createButton(srchFrm1)
sTbl1.sB1.AutoSize=false
sTbl1.sB1.height=25*DP1 sTbl1.sB1.width=120*DP1 sTbl1.sB1.left=210*DP1 sTbl1.sB1.top=9*DP1
sTbl1.sB1.caption="Search"
sTbl1.sB1.Font.Style="fsBold" sTbl1.sB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 -----
sTbl1.sB2=createButton(srchFrm1)
sTbl1.sB2.AutoSize=false
sTbl1.sB2.height=25*DP1 sTbl1.sB2.width=190*DP1 sTbl1.sB2.left=10*DP1 sTbl1.sB2.top=40*DP1
sTbl1.sB2.caption="Clear  Search  List"
sTbl1.sB2.Font.Style="fsBold" sTbl1.sB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB1 -----
sTbl1.sCB1=createComboBox(srchFrm1)
sTbl1.sCB1.AutoSize=true
sTbl1.sCB1.height=22*DP1 sTbl1.sCB1.width=190*DP1 sTbl1.sCB1.left=10*DP1 sTbl1.sCB1.top=10*DP1
sTbl1.sCB1.text=""
sTbl1.sCB1.Font.Style="fsBold" sTbl1.sCB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 -----
sTbl1.sB3=createButton(srchFrm1)
sTbl1.sB3.AutoSize=false
sTbl1.sB3.height=25*DP1 sTbl1.sB3.width=120*DP1 sTbl1.sB3.left=210*DP1 sTbl1.sB3.top=40*DP1
sTbl1.sB3.caption="Copy  Select"
sTbl1.sB3.Font.Style="fsBold" sTbl1.sB3.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB2 -----
sTbl1.sCB2=createComboBox(srchFrm1)
sTbl1.sCB2.AutoSize=true
sTbl1.sCB2.height=22*DP1 sTbl1.sCB2.width=190*DP1 sTbl1.sCB2.left=10*DP1 sTbl1.sCB2.top=70*DP1
sTbl1.sCB2.text=""
sTbl1.sCB2.Font.Style="fsBold" sTbl1.sCB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB4 -----
sTbl1.sB4=createButton(srchFrm1)
sTbl1.sB4.AutoSize=false
sTbl1.sB4.height=25*DP1 sTbl1.sB4.width=120*DP1 sTbl1.sB4.left=210*DP1 sTbl1.sB4.top=70*DP1
sTbl1.sB4.caption="Paste  Select"
sTbl1.sB4.Font.Style="fsBold" sTbl1.sB4.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB5 -----
sTbl1.sB5=createButton(srchFrm1)
sTbl1.sB5.AutoSize=false
sTbl1.sB5.height=25*DP1 sTbl1.sB5.width=120*DP1 sTbl1.sB5.left=210*DP1 sTbl1.sB5.top=100*DP1
sTbl1.sB5.caption="Cut  Select"
sTbl1.sB5.Font.Style="fsBold" sTbl1.sB5.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB6 -----
sTbl1.sB6=createButton(srchFrm1)
sTbl1.sB6.AutoSize=false
sTbl1.sB6.height=25*DP1 sTbl1.sB6.width=190*DP1 sTbl1.sB6.left=10*DP1 sTbl1.sB6.top=100*DP1
sTbl1.sB6.caption="Clear  Paste  List"
sTbl1.sB6.Font.Style="fsBold" sTbl1.sB6.Font.Size=10*DP1
-----------------------
--============================================================================--
--============================================================================--
--============================================================================--

local srcTextTbl={}
local pstTextTbl={}
local assList = MainForm.frmAutoInject.Assemblescreen
local line1 = 0

function clrTbl(tbl)
 for i,k in pairs(tbl) do
  tbl[i] = nil
 end
end

sTbl1.sB1.OnClick=function()
local check1 = 0
 if sTbl1.sCB1.text=="" then
  print("Please type a word in the search text box!")
 else
  newText=sTbl1.sCB1.text
 if string.find(assList.Lines.Text,newText) then
  for l,k in pairs(srcTextTbl) do
   if k==sTbl1.sCB1.text then check1=1 end
  end
  if check1==0 then
   srcTextTbl[#srcTextTbl + 1] = sTbl1.sCB1.text
   sTbl1.sCB1.Items.Add(sTbl1.sCB1.text)
  end
    r1,r2 = string.find(assList.Lines.Text,newText,line1)
   if r2~=nil then
    assList.SelStart=r1
    assList.SelEnd=r2 + 1
    assList.setFocus()
    line1=tonumber(line1) + r2 + 1
    r3,r4 = string.find(assList.Lines.Text,newText,line1)
     if r4==nil then line1=0 end
   end
   else
    showMessage("'"..newText.."'  not found!")
  end
 end
end

sTbl1.sB2.OnClick=function()
clrTbl(srcTextTbl)
  sTbl1.sCB1.clear()
end

sTbl1.sB3.OnClick=function()
s=assList.SelText
writeToClipboard(s)
end

sTbl1.sB4.OnClick=function()
local check2 = 0
  newText1=sTbl1.sCB2.text
  if newText1=="" then newText1=readFromClipboard() end
  for l,k in pairs(pstTextTbl) do
   if k==newText1 then check2=1 end
  end
  if check2==0 then
   pstTextTbl[#pstTextTbl + 1] = newText1
   sTbl1.sCB2.Items.Add(newText1)
  end
 if sTbl1.sCB2.text=="" then
  text2=readFromClipboard()
  assList.SelText=assList.SelText:gsub(assList.SelText,text2)
 else
  assList.SelText=assList.SelText:gsub(assList.SelText,newText1)
 end
end

sTbl1.sB5.OnClick=function()
s=assList.SelText
writeToClipboard(s)
  assList.SelText=assList.SelText:gsub(assList.SelText,"")
end

sTbl1.sB6.OnClick=function()
clrTbl(pstTextTbl)
  sTbl1.sCB2.clear()
end



ek1.PNG
 Description:
 Filesize:  10.39 KB
 Viewed:  2712 Time(s)

ek1.PNG



_________________
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
LeFiXER
Grandmaster Cheater Supreme
Reputation: 20

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

PostPosted: Tue May 09, 2023 1:08 pm    Post subject: Reply with quote

AylinCE wrote:
LeFiXER wrote:
Nice work! Smile


Thanks ..

Here is a different and slightly more comprehensive example:
*Search
*Copy
*Paste (Or Replace)
*Cut
I don't know if I should add a "Replace All" option.

Code:
if srchFrm1 then srchFrm1.Destroy() srchFrm1=nil end
DP1=getScreenDPI()/96
srchFrm1=createForm()
srchFrm1.height=130*DP1 srchFrm1.width=340*DP1 srchFrm1.left=283*DP1 srchFrm1.top=142*DP1
srchFrm1.PopupMode=0 srchFrm1.caption="Search Add Tbl"
srchFrm1.Position="poDesktopCenter" srchFrm1.BorderStyle="bsSingle"  srchFrm1.ShowInTaskBar="stAlways"
-------------------------
local sTbl1 = {}
----------------------- sTbl1.sB1 -----
sTbl1.sB1=createButton(srchFrm1)
sTbl1.sB1.AutoSize=false
sTbl1.sB1.height=25*DP1 sTbl1.sB1.width=120*DP1 sTbl1.sB1.left=210*DP1 sTbl1.sB1.top=9*DP1
sTbl1.sB1.caption="Search"
sTbl1.sB1.Font.Style="fsBold" sTbl1.sB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 -----
sTbl1.sB2=createButton(srchFrm1)
sTbl1.sB2.AutoSize=false
sTbl1.sB2.height=25*DP1 sTbl1.sB2.width=190*DP1 sTbl1.sB2.left=10*DP1 sTbl1.sB2.top=40*DP1
sTbl1.sB2.caption="Clear  Search  List"
sTbl1.sB2.Font.Style="fsBold" sTbl1.sB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB1 -----
sTbl1.sCB1=createComboBox(srchFrm1)
sTbl1.sCB1.AutoSize=true
sTbl1.sCB1.height=22*DP1 sTbl1.sCB1.width=190*DP1 sTbl1.sCB1.left=10*DP1 sTbl1.sCB1.top=10*DP1
sTbl1.sCB1.text=""
sTbl1.sCB1.Font.Style="fsBold" sTbl1.sCB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 -----
sTbl1.sB3=createButton(srchFrm1)
sTbl1.sB3.AutoSize=false
sTbl1.sB3.height=25*DP1 sTbl1.sB3.width=120*DP1 sTbl1.sB3.left=210*DP1 sTbl1.sB3.top=40*DP1
sTbl1.sB3.caption="Copy  Select"
sTbl1.sB3.Font.Style="fsBold" sTbl1.sB3.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB2 -----
sTbl1.sCB2=createComboBox(srchFrm1)
sTbl1.sCB2.AutoSize=true
sTbl1.sCB2.height=22*DP1 sTbl1.sCB2.width=190*DP1 sTbl1.sCB2.left=10*DP1 sTbl1.sCB2.top=70*DP1
sTbl1.sCB2.text=""
sTbl1.sCB2.Font.Style="fsBold" sTbl1.sCB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB4 -----
sTbl1.sB4=createButton(srchFrm1)
sTbl1.sB4.AutoSize=false
sTbl1.sB4.height=25*DP1 sTbl1.sB4.width=120*DP1 sTbl1.sB4.left=210*DP1 sTbl1.sB4.top=70*DP1
sTbl1.sB4.caption="Paste  Select"
sTbl1.sB4.Font.Style="fsBold" sTbl1.sB4.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB5 -----
sTbl1.sB5=createButton(srchFrm1)
sTbl1.sB5.AutoSize=false
sTbl1.sB5.height=25*DP1 sTbl1.sB5.width=120*DP1 sTbl1.sB5.left=210*DP1 sTbl1.sB5.top=100*DP1
sTbl1.sB5.caption="Cut  Select"
sTbl1.sB5.Font.Style="fsBold" sTbl1.sB5.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB6 -----
sTbl1.sB6=createButton(srchFrm1)
sTbl1.sB6.AutoSize=false
sTbl1.sB6.height=25*DP1 sTbl1.sB6.width=190*DP1 sTbl1.sB6.left=10*DP1 sTbl1.sB6.top=100*DP1
sTbl1.sB6.caption="Clear  Paste  List"
sTbl1.sB6.Font.Style="fsBold" sTbl1.sB6.Font.Size=10*DP1
-----------------------
--============================================================================--
--============================================================================--
--============================================================================--

local srcTextTbl={}
local pstTextTbl={}
local assList = MainForm.frmAutoInject.Assemblescreen
local line1 = 0

function clrTbl(tbl)
 for i,k in pairs(tbl) do
  tbl[i] = nil
 end
end

sTbl1.sB1.OnClick=function()
local check1 = 0
 if sTbl1.sCB1.text=="" then
  print("Please type a word in the search text box!")
 else
  newText=sTbl1.sCB1.text
 if string.find(assList.Lines.Text,newText) then
  for l,k in pairs(srcTextTbl) do
   if k==sTbl1.sCB1.text then check1=1 end
  end
  if check1==0 then
   srcTextTbl[#srcTextTbl + 1] = sTbl1.sCB1.text
   sTbl1.sCB1.Items.Add(sTbl1.sCB1.text)
  end
    r1,r2 = string.find(assList.Lines.Text,newText,line1)
   if r2~=nil then
    assList.SelStart=r1
    assList.SelEnd=r2 + 1
    assList.setFocus()
    line1=tonumber(line1) + r2 + 1
    r3,r4 = string.find(assList.Lines.Text,newText,line1)
     if r4==nil then line1=0 end
   end
   else
    showMessage("'"..newText.."'  not found!")
  end
 end
end

sTbl1.sB2.OnClick=function()
clrTbl(srcTextTbl)
  sTbl1.sCB1.clear()
end

sTbl1.sB3.OnClick=function()
s=assList.SelText
writeToClipboard(s)
end

sTbl1.sB4.OnClick=function()
local check2 = 0
  newText1=sTbl1.sCB2.text
  if newText1=="" then newText1=readFromClipboard() end
  for l,k in pairs(pstTextTbl) do
   if k==newText1 then check2=1 end
  end
  if check2==0 then
   pstTextTbl[#pstTextTbl + 1] = newText1
   sTbl1.sCB2.Items.Add(newText1)
  end
 if sTbl1.sCB2.text=="" then
  text2=readFromClipboard()
  assList.SelText=assList.SelText:gsub(assList.SelText,text2)
 else
  assList.SelText=assList.SelText:gsub(assList.SelText,newText1)
 end
end

sTbl1.sB5.OnClick=function()
s=assList.SelText
writeToClipboard(s)
  assList.SelText=assList.SelText:gsub(assList.SelText,"")
end

sTbl1.sB6.OnClick=function()
clrTbl(pstTextTbl)
  sTbl1.sCB2.clear()
end


I would say why not? You've gone this far Smile
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Tue May 09, 2023 1:48 pm    Post subject: Reply with quote

I left a CheckBox checkbox.
If checked, the "Paste" option will change all results.
This is a dangerous option! Shocked Twisted Evil

Code:
if srchFrm1 then srchFrm1.Destroy() srchFrm1=nil end
DP1=getScreenDPI()/96
srchFrm1=createForm()
srchFrm1.height=130*DP1 srchFrm1.width=340*DP1 srchFrm1.left=283*DP1 srchFrm1.top=142*DP1
srchFrm1.PopupMode=0 srchFrm1.caption="Search Add Tbl"
srchFrm1.Position="poDesktopCenter" srchFrm1.BorderStyle="bsSingle"  srchFrm1.ShowInTaskBar="stAlways"
-------------------------
local sTbl1 = {}
----------------------- sTbl1.sB1 -----
sTbl1.sB1=createButton(srchFrm1)
sTbl1.sB1.AutoSize=false
sTbl1.sB1.height=25*DP1 sTbl1.sB1.width=120*DP1 sTbl1.sB1.left=210*DP1 sTbl1.sB1.top=9*DP1
sTbl1.sB1.caption="Search"
sTbl1.sB1.Font.Style="fsBold" sTbl1.sB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 -----
sTbl1.sB2=createButton(srchFrm1)
sTbl1.sB2.AutoSize=false
sTbl1.sB2.height=25*DP1 sTbl1.sB2.width=190*DP1 sTbl1.sB2.left=10*DP1 sTbl1.sB2.top=40*DP1
sTbl1.sB2.caption="Clear  Search  List"
sTbl1.sB2.Font.Style="fsBold" sTbl1.sB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB1 -----
sTbl1.sCB1=createComboBox(srchFrm1)
sTbl1.sCB1.AutoSize=true
sTbl1.sCB1.height=22*DP1 sTbl1.sCB1.width=190*DP1 sTbl1.sCB1.left=10*DP1 sTbl1.sCB1.top=10*DP1
sTbl1.sCB1.text=""
sTbl1.sCB1.Font.Style="fsBold" sTbl1.sCB1.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB3 -----
sTbl1.sB3=createButton(srchFrm1)
sTbl1.sB3.AutoSize=false
sTbl1.sB3.height=25*DP1 sTbl1.sB3.width=120*DP1 sTbl1.sB3.left=210*DP1 sTbl1.sB3.top=40*DP1
sTbl1.sB3.caption="Copy  Select"
sTbl1.sB3.Font.Style="fsBold" sTbl1.sB3.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sCB2 -----
sTbl1.sCB2=createComboBox(srchFrm1)
sTbl1.sCB2.AutoSize=true
sTbl1.sCB2.height=22*DP1 sTbl1.sCB2.width=190*DP1 sTbl1.sCB2.left=10*DP1 sTbl1.sCB2.top=70*DP1
sTbl1.sCB2.text=""
sTbl1.sCB2.Font.Style="fsBold" sTbl1.sCB2.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB4 -----
sTbl1.sB4=createButton(srchFrm1)
sTbl1.sB4.AutoSize=false
sTbl1.sB4.height=25*DP1 sTbl1.sB4.width=100*DP1 sTbl1.sB4.left=210*DP1 sTbl1.sB4.top=70*DP1
sTbl1.sB4.caption="Paste  Select"
sTbl1.sB4.Font.Style="fsBold" sTbl1.sB4.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sChk1 ----- 
sTbl1.sChk1=createCheckBox(srchFrm1)
sTbl1.sChk1.AutoSize=true
sTbl1.sChk1.left=315 sTbl1.sChk1.top=73
sTbl1.sChk1.caption="" sTbl1.sChk1.ShowHint=true
sTbl1.sChk1.Hint="If you check this box,\nall results will change."
-----------------------
----------------------- sTbl1.sB5 -----
sTbl1.sB5=createButton(srchFrm1)
sTbl1.sB5.AutoSize=false
sTbl1.sB5.height=25*DP1 sTbl1.sB5.width=120*DP1 sTbl1.sB5.left=210*DP1 sTbl1.sB5.top=100*DP1
sTbl1.sB5.caption="Cut  Select"
sTbl1.sB5.Font.Style="fsBold" sTbl1.sB5.Font.Size=10*DP1
-----------------------
----------------------- sTbl1.sB6 -----
sTbl1.sB6=createButton(srchFrm1)
sTbl1.sB6.AutoSize=false
sTbl1.sB6.height=25*DP1 sTbl1.sB6.width=190*DP1 sTbl1.sB6.left=10*DP1 sTbl1.sB6.top=100*DP1
sTbl1.sB6.caption="Clear  Paste  List"
sTbl1.sB6.Font.Style="fsBold" sTbl1.sB6.Font.Size=10*DP1
-----------------------
--============================================================================--
--============================================================================--
--============================================================================--

local srcTextTbl={}
local pstTextTbl={}
local assList = MainForm.frmAutoInject.Assemblescreen
local line1 = 0

function clrTbl(tbl)
 for i,k in pairs(tbl) do
  tbl[i] = nil
 end
end

sTbl1.sB1.OnClick=function()
local check1 = 0
 if sTbl1.sCB1.text=="" then
  print("Please type a word in the search text box!")
 else
  newText=sTbl1.sCB1.text
 if string.find(assList.Lines.Text,newText) then
  for l,k in pairs(srcTextTbl) do
   if k==sTbl1.sCB1.text then check1=1 end
  end
  if check1==0 then
   srcTextTbl[#srcTextTbl + 1] = sTbl1.sCB1.text
   sTbl1.sCB1.Items.Add(sTbl1.sCB1.text)
  end
    r1,r2 = string.find(assList.Lines.Text,newText,line1)
   if r2~=nil then
    assList.SelStart=r1
    assList.SelEnd=r2 + 1
    assList.setFocus()
    line1=tonumber(line1) + r2 + 1
    r3,r4 = string.find(assList.Lines.Text,newText,line1)
     if r4==nil then line1=0 end
   end
   else
    showMessage("'"..newText.."'  not found!")
  end
 end
end

sTbl1.sB2.OnClick=function()
clrTbl(srcTextTbl)
  sTbl1.sCB1.clear()
end

sTbl1.sB3.OnClick=function()
s=assList.SelText
writeToClipboard(s)
end

sTbl1.sB4.OnClick=function()
local check2 = 0
  newText1=sTbl1.sCB2.text
  if newText1=="" then newText1=readFromClipboard() end
  for l,k in pairs(pstTextTbl) do
   if k==newText1 then check2=1 end
  end
  if check2==0 then
   pstTextTbl[#pstTextTbl + 1] = newText1
   sTbl1.sCB2.Items.Add(newText1)
  end
  if sTbl1.sChk1.Checked==false then
   if sTbl1.sCB2.text=="" then
    text2=readFromClipboard()
    assList.SelText=assList.SelText:gsub(assList.SelText,text2)
   else
    assList.SelText=assList.SelText:gsub(assList.SelText,newText1)
   end
  else
   if sTbl1.sCB1.text=="" then
    print("Please type a word in the search text box!")
   else
    newText3 = sTbl1.sCB1.text
    if sTbl1.sCB2.text=="" then
     text2=readFromClipboard()
     assList.Lines.Text:gsub(newText3,text2)
    else
     newText1=sTbl1.sCB2.text
     assList.Lines.Text=assList.Lines.Text:gsub(newText3,newText1)
    end
   end
  end
end

sTbl1.sB5.OnClick=function()
s=assList.SelText
writeToClipboard(s)
  assList.SelText=assList.SelText:gsub(assList.SelText,"")
end

sTbl1.sB6.OnClick=function()
clrTbl(pstTextTbl)
  sTbl1.sCB2.clear()
end

_________________
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
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Tue May 09, 2023 6:44 pm    Post subject: Reply with quote

This example is sufficient for now. I'm also interested in this question: is it possible to select all the same words in Lua script when one same word is selected?
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed May 10, 2023 12:26 am    Post subject: Reply with quote

My simple solution for all of these are: Used text editor for programming script like: Notepad++, LuaEdit, CodeBlock, etc Very Happy (someone ever said: "Why make it difficult when there is an easy way")
_________________
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: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Wed May 10, 2023 1:56 am    Post subject: Reply with quote

Corroder wrote:
(someone ever said: "Why make it difficult when there is an easy way")


A question comes to my mind:

I guess it is not easy to use Notepad++ with CE GUI or CE syntax.

Edit it in Notepad++, export it to CE Lua Script (especially for GUI tests!) and try it out.
Doing this 10,20,30 times in a row would be tiring.

I guess the easy way is to enrich CE Lua Script and help add more features.

@Corroder, my old friend, you are a person who has implemented rare features, code, into CE. Notepad++ can't make you lazy. Very Happy Cool Twisted Evil

(Maybe we should write a code that we can edit in Notepad++ and transfer it to CE lua script. Of course both must be on at the same time.
I doubt this is the easy way.)
--===============================--
@Razi:
I will try your last comment.
But it would be wiser to get a recommendation from the DB for this.

_________________
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
Razi
Expert Cheater
Reputation: 1

Joined: 17 Jan 2018
Posts: 202

PostPosted: Wed May 10, 2023 8:41 am    Post subject: Reply with quote

AylinCE wrote:
Maybe we should write a code that we can edit in Notepad++ and transfer it to CE lua script.

I have already replaced the edit box with a combo box in CE source (actually lazarus source files) and already edited the lazarus files, but not finished yet. (Need to know how to properly Move combobox items) But, this requires to edit 2 lazarus files: finddialog.inc, replacedialog.inc and compiling CE. Just need to add a few lines of code to these files. This can be done for any version of CE.



ezgif-5-6b62c410ba.gif
 Description:
 Filesize:  41.45 KB
 Viewed:  2593 Time(s)

ezgif-5-6b62c410ba.gif



ezgif-5-30169ed9b4.gif
 Description:
 Filesize:  67.71 KB
 Viewed:  2592 Time(s)

ezgif-5-30169ed9b4.gif




Last edited by Razi on Fri May 12, 2023 8:46 am; edited 3 times in total
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
Goto page 1, 2  Next
Page 1 of 2

 
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