View previous topic :: View next topic |
Author |
Message |
abystus Expert Cheater
Reputation: 1
Joined: 09 Dec 2010 Posts: 140
|
Posted: Mon Jun 22, 2015 12:02 pm Post subject: Copy Text (Memory View) |
|
|
Is there a way to copy the text displayed on the right side of the memory viewer? So far I've only been able to copy the bytes that make up the text, which I then have to manually convert to text using another tool. Any help is appreciated.
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc... |
|
Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Jun 22, 2015 12:17 pm Post subject: |
|
|
Are you dealing with actual strings? Try some Lua:
Code: | local address = "004C6558"
local length = 100
local use_unicode = true
local value = readString(address, length, use_unicode)
print(value) |
|
|
Back to top |
|
 |
abystus Expert Cheater
Reputation: 1
Joined: 09 Dec 2010 Posts: 140
|
Posted: Mon Jun 22, 2015 12:32 pm Post subject: |
|
|
Yes, just copying the Unicode text displayed on the right of the Memory View window. I had hoped there was a way build into cheat engine already (seems it would be quite easy to add to a right-click menu, also I didn't want to resort to Lua for common functionality that would normally be included by default), but this should definitely do exactly what I need. Thanks for the quick response.
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc... |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Mon Jun 22, 2015 12:59 pm Post subject: |
|
|
save this lua file to the autorun folder of cheat engine and you'll have a rightclick menu that says "copy as text to clipboard" (ctrl+alt+c)
Description: |
|
 Download |
Filename: |
copytoclipboardastext.lua |
Filesize: |
416 Bytes |
Downloaded: |
740 Time(s) |
_________________
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 |
|
 |
abystus Expert Cheater
Reputation: 1
Joined: 09 Dec 2010 Posts: 140
|
Posted: Mon Jun 22, 2015 1:03 pm Post subject: |
|
|
Thanks for the integration Dark Byte (I'll give it a test when I arrive home). Do you possibly plan on including this into a future build, or do you feel the Lua integration method is best for this tiny addons? I appreciate all the help (both of you).
Edit:
Just tested at work, and appears it only copies the first letter of a selected block of text. Looking into the Lua file now...
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc... |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Mon Jun 22, 2015 1:15 pm Post subject: |
|
|
oh, it's unicode ? (That ends at the first 0 byte)
Then instead of byteTableToString try byteTableToWideString
And for tiny add-ons like this I really believe lua is the best option. As you may have noticed, the context menu is getting pretty big, and only having the items you need may be a better solution
_________________
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 |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Mon Jun 22, 2015 1:21 pm Post subject: |
|
|
replace the script with this and it may be able to detect it (assuming you are targetting an ascii based unicode language, else you really need two separate copy to clipboard menu options)
Code: |
hexView=getMemoryViewForm().HexadecimalView
m=hexView.PopupMenu
mi=createMenuItem(m)
mi.Caption="Copy as text to clipboard"
mi.Shortcut="Ctrl+Alt+C"
mi.OnClick=function(sender)
if hexView.HasSelection then
local l=hexView.SelectionStop-hexView.SelectionStart+1
local bytes=readBytes(hexView.SelectionStart, l,true)
local s
if (l>1) and (bytes[2]==0) then --widestring
s=byteTableToWideString(bytes)
else
s=byteTableToString(bytes)
end
writeToClipboard(s)
end
end
m.items.insert(5,mi)
|
_________________
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 |
|
 |
abystus Expert Cheater
Reputation: 1
Joined: 09 Dec 2010 Posts: 140
|
Posted: Mon Jun 22, 2015 1:25 pm Post subject: |
|
|
Dark Byte wrote: | oh, it's unicode ? (That ends at the first 0 byte)
Then instead of byteTableToString try byteTableToWideString
And for tiny add-ons like this I really believe lua is the best option. As you may have noticed, the context menu is getting pretty big, and only having the items you need may be a better solution |
Tried the following:
Code: |
local bytes=readBytes(hexView.SelectionStart, hexView.SelectionStop-hexView.SelectionStart+1,true)
local s=byteTableToWideString(bytes)
writeToClipboard(s)
|
Still seems to only copy the first character or so. And yes, the menu is rather large, but then again there could always be categorized sub-menus. Thanks for the help thus far.
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc... |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25788 Location: The netherlands
|
Posted: Mon Jun 22, 2015 1:33 pm Post subject: |
|
|
I don't know. byteTableToWideString worked for me on the small unicode string I tested with.
Can you post the first few hexadecimal bytes? Does it contain more than one 0-byte in a sequence ?
Or is it working with the new script (Do not forget to restart CE for the changes to take affect)
Else, if you want the raw code, just like CE shows it. (unknown characters as a . )
then go through the bytetable before converting it, and convert all the values smaller than 31 to 46 (.)
(and bigger or equal than 192 as well)
Which is another reason for lua. I could implement the copy to clipboard so it is a pure copy, including the 0 byte terminator, or do as ce displays it, using '.' as filler space.
Different people want different copy methods for different situations
_________________
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 |
|
 |
abystus Expert Cheater
Reputation: 1
Joined: 09 Dec 2010 Posts: 140
|
Posted: Mon Jun 22, 2015 1:43 pm Post subject: |
|
|
You just hit the nail on the head. My selected block contained a few 0 bytes in sequence which was terminated the string. It seems that if I select just the text and not the entire block then it works. I will convert all bytes below 31 and 192 and above to 46 like you suggested to get those turned into periods. I really appreciate your help.
Edit:
Here is the updated version (Unicode & Ascii) which copies the text just like it is displayed in Cheat Engine:
Code: |
hexView=getMemoryViewForm().HexadecimalView
m=hexView.PopupMenu
mi=createMenuItem(m)
mi.Caption="Copy as text to clipboard"
mi.Shortcut="Ctrl+Alt+C"
mi.OnClick=function(sender)
if hexView.HasSelection then
local bytes=readBytes(hexView.SelectionStart, hexView.SelectionStop-hexView.SelectionStart+1,true)
for i=1,table.getn(bytes) do
if (bytes[i] < 31) then
bytes[i] = 46
elseif (bytes[i] >= 128) then
bytes[i] = 32
end
end
local s=byteTableToString(bytes)
writeToClipboard(s)
end
end
m.items.insert(5,mi)
|
Thanks again.
Description: |
Unicode & Ascii Text copy right-click menu (Memory View). Place in the autorun directory. |
|
 Download |
Filename: |
copytoclipboardastext.lua |
Filesize: |
556 Bytes |
Downloaded: |
584 Time(s) |
_________________
Hitler are you bored? Watch some of my hacks here. Want 2 gb of online storage space for free? Get Dropbox for computer, phone, etc... |
|
Back to top |
|
 |
|