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 


Using shellExecute to execute `Yes to ALL!`

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

Joined: 17 Aug 2020
Posts: 170
Location: Milkey Way

PostPosted: Tue Aug 25, 2020 9:04 am    Post subject: Using shellExecute to execute `Yes to ALL!` Reply with quote

Thank you @Dark Byte your suggestion to look in savesession.lua
solved my problem of enabling Next Scan but with it a new problem arosed.

Thing is Im using this code
Code:
shellExecute('xcopy','\"'..dir1..'\" \"'..dir2..'\"')

to copy all files, where dir1 holds the directory of the scan tab to be cloned and dir2 holds the directory of the scan tab created as a cloned.

As you can see by using this:
Code:
MainForm.scanvalue.Text='982451653'
  MainForm.vartype.itemindex=3
  MainForm.scantype.itemindex=0
  MainForm.btnNewScan.doClick()

before using shellExecute, it creates some files in dir2 with the same name as of dir1 so when I execute my code a cmd appears which asks me to replace files. I have to click y multiple times to make my script successful.

What I want to ask you guys is How to use shellExecute so that it will replace all the files in dir2 without opening cmd to ask me to click y again and again.

And if there is another way to do it than using shellExecute then plz tell me.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 25, 2020 9:39 am    Post subject: Reply with quote

Assume Dir1 is source directory and Dir2 is destination directory.

Code:
shellExecute('xcopy',"D:\\Dir1 D:\\Dir2 /K /D /H /Y")


/K = Copies files and retains the read-only attribute on Destination files if present on the Source files. By default, xcopy removes the read-only attribute.

/D = Copies source files changed on or after the specified date only. If you do not include a MM-DD-YYYY value, xcopy copies all Source files that are newer than existing Destination files. This command-line option allows you to update files that have changed.

/H = Copies files with hidden and system file attributes. By default, xcopy does not copy hidden or system files

/Y = Suppresses prompting to confirm that you want to overwrite an existing destination file.

Complete xcopy parameters:
https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/xcopy

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

Joined: 17 Aug 2020
Posts: 170
Location: Milkey Way

PostPosted: Tue Aug 25, 2020 9:51 am    Post subject: Reply with quote

Thanks! It Works .But when files to be copied are heavy it opens cmd. Is there any way to keep it hidden no matter how long it takes?

Also I heard there is an os.execute function. How does this work and is it
somehow related to shellExecute, if yes then how can I use it to do what I did with shellExecute
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Tue Aug 25, 2020 12:20 pm    Post subject: Reply with quote

To avoid cmd window pop-up / flashing:

Code:
--shellExecute show defines:
SW_HIDE = 0
SW_MAXIMIZE = 3
SW_MINIMIZE = 6
SW_NORMAL = 1
SW_RESTORE = 9
SW_SHOW = 5
SW_SHOWDEFAULT = 10
SW_SHOWMAXIMIZED = 3
SW_SHOWMINIMIZED = 2
SW_SHOWMINNOACTIVE = 7
SW_SHOWNA = 8
SW_SHOWNOACTIVATE = 4
SW_SHOWNORMAL = 1

cmd = 'xcopy /E /K /O /Y "D:\\Dir1" "D:\\Dir2"'
shellExecute("cmd.exe", "/c "..cmd, 0, SW_HIDE)


Using os.execute (but with cmd window pop-up). You need to make a batch file to run the batch file with some command to avoid cmd window pop-up.

Code:
os.execute('xcopy /E /K /O /Y D:\\Dir1 D:\\Dir2')

-- or

io.popen('xcopy /E /K /O /Y D:\\Dir1 D:\\Dir2')


Note:
os.execute is Lua function and shellExecute is CE Lua function, if I am not wrong.

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

Joined: 17 Aug 2020
Posts: 170
Location: Milkey Way

PostPosted: Tue Aug 25, 2020 12:45 pm    Post subject: Reply with quote

Thanks it works!
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