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 


take screenshot of whole screen

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Sun Jun 06, 2021 9:02 pm    Post subject: take screenshot of whole screen Reply with quote

i want to take a screenshot of the whole screen, but prn sc does not work for me. ive heard of this script which you can put into ceimage but i still dont understand how it works :

Code:
w=getScreenWidth()
h=getScreenHeight()
sc=getScreenCanvas()


is it possible to take one and save it as a png / jpg image to desktop?
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Jun 06, 2021 10:29 pm    Post subject: Reply with quote

Example :

Code:
UDF1.width = 100
UDF1.height = 40
UDF1.btnCatch.top = 5
a = getMainForm()
a.visible = false
UDF1.CEPanel1.visible = false

function catchScreen()
 a = getMainForm()
 a.visible = false
 UDF1.CEPanel1.visible = true
 w=getScreenWidth()
 h=getScreenHeight()
 sc=getScreenCanvas()
 UDF1.CEImage1.Stretch=true
 UDF1.CEImage1.Picture.Bitmap.Width=w
 UDF1.CEImage1.Picture.Bitmap.Height=h
 UDF1.CEImage1.canvas.copyRect(0,0,w,h,sc,0,0,w,h)
 UDF1.width = 550
 UDF1.height = 450
 UDF1.btnCatch.top = 405
 UDF1.Position = 'poScreenCenter'
end

function catchClear()
 pic = UDF1.CEImage1.Canvas
 pic.clear()
 UDF1.width = 100
 UDF1.height = 40
 UDF1.btnCatch.top = 5
 UDF1.Position = 'poScreenCenter'
 UDF1.CEPanel1.visible = false
end

function btnCatchClick(sender)
 catchScreen()
end

function btnClearClick(sender)
 catchClear()
end

function btnSaveClick(sender)
 path = TrainerOrigin or getMainForm()
 dialog=createSaveDialog()
 dialog.DefaultExt=".jpg"
 dialog.Filter="JPG Image (*.jpg)|*.jpg"
 dialog.FilterIndex=1
 dialog.Options = '[ofOverwritePrompt, ofEnableSizing]'
 if dialog.execute() then  UDF1.CEImage1.Picture.saveToFile(dialog.Filename) end
 dialog.destroy()
end

function FormClose(sender)
 a = getMainForm()
 a.visible = true
 closeCE()
 return caFree   ----, caMinimize, caNone
end

UDF1.show()

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Mon Jun 07, 2021 6:57 am    Post subject: Reply with quote

okay i think i finally understand how the code works, heres one for anyone who wants it :

Code:
w=getScreenWidth()
h=getScreenHeight()
sc=getScreenCanvas()
f = createForm()
f.width = 0
f.height = 0
f.left = (w + 1) -- so doesnt appear on screen
img = createImage(f)
img.Stretch = true
img.Picture.Bitmap.Width=w
img.Picture.Bitmap.Height=h
img.canvas.copyRect(0,0,w,h,sc,0,0,w,h)
USER = os.getenv("USERNAME")
path="C:\\Users\\"..USER.."\\Desktop" -- directory
img.Picture.saveToFile(path..'\\screenshot.jpg')
closeCE()
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