|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
Sondio Newbie cheater Reputation: 1
Joined: 07 Mar 2019 Posts: 18
|
Posted: Tue Apr 23, 2019 10:29 pm Post subject: Lua + wmic |
|
|
Hey there,
I'm trying to retrieve ram information via wmic;
this is what I did (in a basic way)
Code: |
--===========================================================================GUI
f = createForm()
f.Width = 360
f.Height = 180
f.Position = 'poScreenCenter'
f.Color = '0x1F1F1F'
f.Caption = 'RAM Info'
f.font.color = '0xFF9000'
f.BorderStyle = 'bsSingle'
--------------------------------------------------------------------------labels
lbl_ramc = createLabel(f)
lbl_ramc.left = 10
lbl_ramc.top = 10
lbl_ramc.caption = 'RAM Capacity :'
lbl_ramc.Font.Color = '0xFF9000'
lbl_ramc.font.style = 'fsBold,fsItalic'
lbl_ramc.Font.Size = 10
lbl_ramsn = createLabel(f)
lbl_ramsn.left = lbl_ramc.left
lbl_ramsn.top = lbl_ramc.top + lbl_ramc.height + 10
lbl_ramsn.caption = 'Serial Number :'
lbl_ramsn.Font.Color = '0xFF9000'
lbl_ramsn.font.style = 'fsBold,fsItalic'
lbl_ramsn.Font.Size = 10
------------------------------------------------------------------------editboxs
edt_ramc = createEdit(f)
edt_ramc.left = edt_ramc.left + edt_ramc.width + 60
edt_ramc.top = edt_ramc.top + 11
edt_ramc.width = 160
edt_ramc.BorderStyle = 'bsNone'
edt_ramc.Font.Color = '0x00FF00'
edt_ramc.Font.Size = 10
edt_ramc.font.style = 'fsBold'
edt_ramc.color = '0x1F1F1F'
edt_ramc.Text = ''
edt_ramsn = createEdit(f)
edt_ramsn.left = edt_ramc.left
edt_ramsn.top = edt_ramc.top + edt_ramc.height + 5
edt_ramsn.width = 540
edt_ramsn.BorderStyle = 'bsNone'
edt_ramsn.Font.Color = '0x00FF00'
edt_ramsn.Font.Size = 10
edt_ramsn.font.style = 'fsBold'
edt_ramsn.color = '0x1F1F1F'
edt_ramsn.Text = ''
-------------------------------------------------------------------------buttons
ckcb = createButton(f)
ckcb.top = 135
ckcb.left = 5
ckcb.height = 38
ckcb.width = 110
ckcb.font.style = 'fsbold,fsItalic'
ckcb.caption = 'CHECK'
ckcb.color = '0x2F2F2F'
--=====================================================================functions
function checkram(sender)
local file = assert(io.popen("wmic MEMORYCHIP GET SerialNumber /value", "r"))
local iLine = 1
for line in file:lines() do
if iLine > 1 then
for token in string.gmatch(line, "[^%s]+") do
local result = string.match(line, "=(.*)")
edt_ramsn.Text = result
end
end
iLine = iLine + 1
end
file:close()
local file = assert(io.popen("wmic MEMORYCHIP GET Capacity /value", "r"))
local iLine = 1
for line in file:lines() do
if iLine > 1 then
for token in string.gmatch(line, "[^%s]+") do
local result = string.match(line, "=(.*)")
edt_ramc.Text = result
end
end
iLine = iLine + 1
end
file:close()
end
function close()
f.Destroy()
end
--========================================================================events
ckcb.onClick = checkram
f.onClose = close
|
if I have more ram banks, how can I report the values of the individual banks and merge them into a single output line with a comma??
(like: bankslot1, bankslot2)
thanks in advance
_________________
DaSpamer
I am the leader of the lazy and with the books I made filters !!! |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Tue Apr 23, 2019 10:38 pm Post subject: |
|
|
Simply run :
Code: | >wmic MEMORYCHIP get BankLabel,DeviceLocator,Capacity,Tag
BankLabel Capacity DeviceLocator Tag
BANK 0 2147483648 Bottom - Slot 1 (top) Physical Memory 0
BANK 1 4294967296 Bottom - Slot 2 (under) Physical Memory 1 |
to get the result and save as text file:
Code: | >wmic MEMORYCHIP get >data.txt
>start data.txt |
Note: the result should be according to motherboard type and model
EDIT :
It's simple use os.execute :
Code: | function checkRAM()
cmd = 'wmic MEMORYCHIP get BankLabel,DeviceLocator,Capacity,Tag >MyRAMDetail.txt'
os.execute(cmd)
end |
And you can use those extra columns to customize the first command to give you, e.g., the manufacturer name, product number, and serial number.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Sondio Newbie cheater Reputation: 1
Joined: 07 Mar 2019 Posts: 18
|
Posted: Wed Apr 24, 2019 7:10 pm Post subject: |
|
|
*.* Sensei
yes I know this cmd line;
but how can I obtain, for example only the capacities of the relative ram installed, without creating any files, and report the values in a single label in the form ..?
another example:
# one ram installed
Serial number: XXXXXXXX
Part number: XXXXXXXX
Capacity: 2Gb
# two or more ram installed
Serial number: XXXXXXXX, YYYYYYYY
Part number: XXXXXXXX, YYYYYYYY
Capacity: 2Gb, 4Gb
Thanks in advance
_________________
DaSpamer
I am the leader of the lazy and with the books I made filters !!! |
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Wed Apr 24, 2019 11:13 pm Post subject: |
|
|
Since I just have 1 slot RAM installed on my machine, then I can't test for 2 slots or more slots RAM.
The idea is saving check RAM results to a table and then get values on the table as variables.
Following code is to check RAM Bank Slot, Capacity and Serial No.
I made UDF1 form with 6 labels.
Code: | t = {}
function checkram()
local file = assert(io.popen("wmic MEMORYCHIP GET BankLabel,SerialNumber,Capacity /value", "r"))
local iLine = 1
for line in file:lines() do
if iLine > 1 then
for token in string.gmatch(line, "[^%s]+") do
local result = string.match(line, "=(.*)")
--print('RAM Bank Slot : :'..result)
table.insert(t, result)
end
end
iLine = iLine + 1
end
for i,v in ipairs(t) do print(i,v) end
UDF1.CELabel4.Caption = t[2]
UDF1.CELabel5.Caption = t[3]
UDF1.CELabel6.Caption = t[4]
end
checkram() |
So, if RAM slots more than 1 slot installed (I think max. is 4 slots), then need to add labels or edit boxes and code add:
Code: | UDF1.CELabel7.Caption = t[6]
UDF1.CELabel8.Caption = t[7]
UDF1.CELabel9.Caption = t[8]
-- and so on
|
EDIT :
to convert Bytes to Gigabytes (as my RAM capacity):
bytes = 8589934592 / 1024
KB = 8388608 / 1024
MB = 8192 / 1024
GB = 8
or similar to
GB = 8589934592 / 1073741824 = 8 Gb
Description: |
|
Filesize: |
65.66 KB |
Viewed: |
1525 Time(s) |
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
Sondio Newbie cheater Reputation: 1
Joined: 07 Mar 2019 Posts: 18
|
Posted: Thu Apr 25, 2019 6:09 pm Post subject: |
|
|
thank you very much Sensei !!
_________________
DaSpamer
I am the leader of the lazy and with the books I made filters !!! |
|
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
|
|