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 


Save file to disk from table in lua

 
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: Mon May 24, 2021 5:24 am    Post subject: Save file to disk from table in lua Reply with quote

Is it possible to save a file to a directory e.g. Documents from the ce table?

e.g. i want to save a picture / etc. to C:\Pictures

Picture.jpg

save do C:\Users\%USERNAME%\Pictures

or etc.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed May 26, 2021 8:03 pm    Post subject: Reply with quote

No ones?.

This is an example :

Code:
if f then f.destroy() end

local f = createForm()
local p = createImage(f)
local s = findTableFile('ce.png')

if not s then
 showMessage('Not found')
 return
else
 p.Picture.loadFromStream(s.Stream)
 p.Stretch = true
 local path = TrainerOrigin or getMainForm()
 local dialog=createSaveDialog()
 dialog.DefaultExt =".png"
 dialog.Filter = "PNG Image (*.png)|*.png"
 dialog.FilterIndex = 1
 dialog.Options = '[ofOverwritePrompt, ofEnableSizing]'
 if dialog.execute() then  p.Picture.saveToFile(dialog.Filename) end
 dialog.destroy()
end

_________________
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: Thu May 27, 2021 1:56 am    Post subject: Reply with quote

how do i make it autosave into a directory?
Back to top
View user's profile Send private message
ByTransient
Expert Cheater
Reputation: 5

Joined: 05 Sep 2020
Posts: 240

PostPosted: Thu May 27, 2021 4:33 am    Post subject: Reply with quote

Code:
local path=[[C:\Users\YourFolder]]
file1 = 'ce.png'
findTableFile(file1).saveToFile(path..'\\'..file1)


or

https://forum.cheatengine.org/viewtopic.php?t=617603
Back to top
View user's profile Send private message
HexaG0n
Advanced Cheater
Reputation: 0

Joined: 29 Mar 2021
Posts: 64

PostPosted: Thu May 27, 2021 7:36 am    Post subject: Reply with quote

Ahh thanks, it works now! Very Happy

Code:

local USER = os.getenv("USERNAME")
local path="C:\\Users\\"..USER.."\\Desktop"
file1 = 'ce.png'
findTableFile(file1).saveToFile(path..'\\'..file1)
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