|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sat Jan 31, 2015 6:10 pm Post subject: list of all TableFiles, how to get it? |
|
|
Is there a nice method to get a list of all TableFile objects?
The first thing that comes to my mind is to use MenuItems.
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25296 Location: The netherlands
|
Posted: Sat Jan 31, 2015 6:40 pm Post subject: |
|
|
hmm no, i'd assume the creator of the table would know which files are attached
try the menuitems yes
_________________
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 |
|
|
DaSpamer Grandmaster Cheater Supreme Reputation: 52
Joined: 13 Sep 2011 Posts: 1578
|
Posted: Sun Feb 01, 2015 1:24 pm Post subject: |
|
|
Code: | function getTableFiles()
local main = getMainForm().getMenu().getItems().getItem(3);
local excludeList = {["Show Cheat Table Lua Script"] = true; ["Resynchronize forms with Lua"] = true; ["Show Cheat Table Lua Script"] = true; ["-"] = true; ["Add file"] = true; ["Create form"] = true;};
local out = {};
for i = 0, main.count-1 do
local object = main.getItem(i);
if (not excludeList[object.Caption]) then
table.insert(out,object);
print(object.Caption);
end
end
return out;
end
files = getTableFiles(); |
This works as long as the 'Table' menu gets updated (by clicking on it).
Any 'hacks' to force an update?
_________________
|
|
Back to top |
|
|
mgr.inz.Player I post too much Reputation: 218
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Sun Feb 01, 2015 1:33 pm Post subject: |
|
|
yeah I already have this.
(I didn't post it because I was working on "playing MP3 files with playSound")
My solution:
Code: | function listOfTableFiles()
local mf = getMainForm()
local tableMenu = mf.miTable
tableMenu.OnClick(nil) -- refresh menu (it will call internal UpdateMenu procedure)
local tableMenuCount = mf.miTable.Count
local list = {}
if tableMenuCount>6 then
for i=0,tableMenuCount-1 do repeat
local item=tableMenu[i]
local tableFileName = item.Caption
local tableFile = findTableFile(tableFileName)
if tableFile==nil then break --[[continue]] end
list[#list+1] = {name=tableFileName,tableFile=tableFile}
until true end -- for loop
end -- if tableMenuCount>6 then
return list
end |
_________________
|
|
Back to top |
|
|
panraven Grandmaster Cheater Reputation: 55
Joined: 01 Oct 2008 Posts: 942
|
Posted: Sun Feb 01, 2015 1:39 pm Post subject: |
|
|
My attempts:)
Find the target children menuitem under a specific menuitem ('table') with certain condition (1st child has a certain caption, ie. 'Rename' or 'Restore and show')
It rely on finding the target menuitem by Caption, may not reliable.
(UPD: add menuitem update code from mgr.inz.Player
Code: |
rawCaption = function(s) return s:gsub('[^%w]',''):lower() end
isSameCaption = function(m,s) return rawCaption(s) == rawCaption(m.Caption or m.Description) end
indexByCaption = function(root,s, ...)
if type(s) ~= 'string' then return root,true end
for i=0,root.Count-1 do
if isSameCaption(root[i],s) then return indexByCaption(root[i],...) end
end
return root,false
end
function filterMenuChildren(root,condf)
local r = {}
for i=0,root.Count-1 do if condf(i,root[i]) == true then r[1+#r]=root[i] end end
return r,#r > 0
end
-- ====
function findTableEntry()
local tableMenu,found = indexByCaption(getMainForm().Menu.Items, 'Table')
tableMenu.OnClick(nil) -- refresh menu (it will call internal UpdateMenu procedure)
return found and filterMenuChildren(tableMenu, function(i,m)
return m.Count >= 3 and isSameCaption(m[0],'Rename')
end) or {}
end
function findFormEntry()
local tableMenu,found = indexByCaption(getMainForm().Menu.Items, 'Table')
tableMenu.OnClick(nil) -- refresh menu (it will call internal UpdateMenu procedure)
return found and filterMenuChildren(tableMenu, function(i,m)
return m.Count >= 3 and isSameCaption(m[0],'Restore and Show')
end) or {}
end
-- ==== test
local tt = findTableEntry()
for i=1,#tt do print(i,tt[i].Caption) end
tt = findFormEntry()
for i=1,#tt do print(i,tt[i].Caption) end |
|
|
Back to top |
|
|
|
|
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
|
|