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 


Button copy String to Clipboard?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
jededias
!BEWARE! Deletes post on answer
Reputation: 0

Joined: 15 Apr 2017
Posts: 17

PostPosted: Sat May 27, 2017 6:48 pm    Post subject: Button copy String to Clipboard? Reply with quote

When click a button, it copy a text to clipboard, like this in delphi:
Clipboard.AsText := Edit1.text;
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Sat May 27, 2017 9:03 pm    Post subject: Reply with quote

from main.lua in ce dir:

Quote:
writeToClipboard(text): Writes the given text to the clipboard
readFromClipboard(): Reads the text from the clipboard


and

Quote:
Edit Class: (Inheritance: WinControl->Control->Component->Object)
createEdit(owner): Creates an Edit class object which belongs to the given owner. Owner can be any object inherited from WinControl

properties
Text: string - The current contents of the editfield
SelText: string - The current selected contents of the edit field (readonly)
...

methods
clear()
copyToClipboard()
cutToClipboard()
pasteFromClipboard()


so Edit1.copyToClipboard() should work or writeToClipboard(Edit1.SelText).
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat May 27, 2017 9:13 pm    Post subject: Reply with quote

example :

Code:
f = createForm()
b = createButton(f)
b.Caption = 'Click Me'
t = createEdit(f)
t.left = b.width + 5
t.width = 150
otext = 'Origin Text'
t.text = otext

stext = 'Clipboard Text'
-- or a text / string variable get from clipboard or what ever

function getCText()
t.text = stext
end

b.onClick = getCText


or

Code:
f = createForm()
b = createButton(f)
b.Caption = 'Click Me'
t = createEdit(f)
t.left = b.width + 5
t.width = 150
t.text = 'Store To Clip'

b1 = createButton(f)
b1.Caption = 'Get Ori'
b1.Top = b.Top + b.height + 10

function storeText()
t.copyToClipboard()
showMessage('Text Copied To Clipboard')
return
t.clear()
end

function getBackText()
t.pasteFromClipboard()
end

b.onClick = storeText
b1.onClick = getBackText

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
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
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