View previous topic :: View next topic |
Author |
Message |
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1252
|
Posted: Sat Feb 17, 2018 12:51 pm Post subject: How can I encode closing an open program with CE Close? |
|
|
Here is a code for getting started.
When the Trainer is turned on, simultaneously .exe file is opened.
When I close the Trainer, it is shutting down .exe file.
This functionality works well
Code: | function CEImage4Click(sender)
shellExecute([[C:\Program Files (x86)\Cheat Engine 6.7\autorun\Close.bat]]);
closeCE()
end
--------------------------------------------
shellExecute([[C:\Windows\System32\StikyNot.exe]]);
form_onClose(UDF1, CloseTrainer)
form_show(UDF1) |
(I will describe the .bat file and its functionality in a separate forum.)
How can I do this opening and closing with Cheat Engine?
Without the trainer, only with the Cheat engine.
but I closed the file with "shellExecute" on the trainer,
(Game.exe, etc.) How do I relate to Cheat Engine Close?
thanks in advance for your valuable ideas.
_________________
|
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Sat Feb 17, 2018 1:59 pm Post subject: |
|
|
Code: | function openExe(...)
local before = getProcesslist()
shellExecute(...)
local after = getProcesslist()
for k,v in pairs(after) do
if not before[k] then return k,v end
end
end
local openedPID = openExe('notepad')
local MainOnClose = MainForm.OnClose
MainForm.OnClose = function(...)
shellExecute('taskkill', '/PID ' .. openedPID)
return MainOnClose(...)
end |
mostly seems to work, though for whatever reason CE is left running as a background process... Would probably work fine for a trainer that had it's own form rather than the MainForm used in tables (which is how I tested it).
_________________
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1252
|
Posted: Sat Feb 17, 2018 3:05 pm Post subject: |
|
|
FreeER wrote: | Code: | function openExe(...)
local before = getProcesslist()
shellExecute(...)
local after = getProcesslist()
for k,v in pairs(after) do
if not before[k] then return k,v end
end
end
local openedPID = openExe('notepad')
local MainOnClose = MainForm.OnClose
MainForm.OnClose = function(...)
shellExecute('taskkill', '/PID ' .. openedPID)
return MainOnClose(...)
end |
mostly seems to work, though for whatever reason CE is left running as a background process... Would probably work fine for a trainer that had it's own form rather than the MainForm used in tables (which is how I tested it). |
Your method is used in a form (Trainer)!
Is it correct?
If so, I am looking for a method that is used with Cheat Engine.
For example; When Cheat Engine is opened, Game.exe will be opened.
And when Cheat Engine is shut down, Game.exe will close!
I'm looking for an encoding to do this.
I have this solution, I will present it with a CT and Video.
How to turn on and off Game.exe in Trainer.
I already have this encoding.
I tried and worked successfully.
But I need it with Cheat Engine.
Opening-closing, coding and path are required.
I should use this command as an LUA or DLL. etc.
What kind of coding will get me closer to the target, Master?
_________________
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 458
Joined: 09 May 2003 Posts: 25288 Location: The netherlands
|
Posted: Sat Feb 17, 2018 5:46 pm Post subject: |
|
|
in the OnClose method of CE have this code:
Code: |
executeCode('Exit')
|
_________________
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 |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Sat Feb 17, 2018 6:50 pm Post subject: |
|
|
Script provide by @FreeER already gave an answer and solution, just save this script as Lua file and save to CE autorun folder.
Code: | function openExe(...)
local before = getProcesslist()
shellExecute(...)
local after = getProcesslist()
for k,v in pairs(after) do
if not before[k] then return k,v end
end
end
local openedPID = openExe('notepad')
local MainOnClose = MainForm.OnClose
MainForm.OnClose = function(...)
shellExecute('taskkill', '/PID ' .. openedPID)
return MainOnClose(...)
end |
Or another version to do same process as above :
Code: | getLuaEngine().cbShowOnPrint.Checked=false
getLuaEngine().hide()
game_check_list = createStringlist()
function game_check()
getProcesslist(game_check_list)
local count = 0
for i=0,game_check_list.count-1 do
if game_check_list[i]:find("notepad") then
count = count + 1
end
end
if count > 1 then
showMessage("Can not identify game process. Use manual attach")
else
local path = 'C:\\Windows\\notepad.exe'
shellExecute(path) --- change to process name you wish to open
openProcess('notepad')
showMessage("Process found and opened")
return
end
game_check_list.clear()
end
function onCloseCE()
local id = getOpenedProcessID()
os.execute("taskkill -im "..id)
closeCE()
return caFree
end
game_check()
MainForm.OnClose = onCloseCE
|
save as a Lua file and place to CE autorun folder
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1252
|
Posted: Sat Feb 17, 2018 8:19 pm Post subject: |
|
|
Corroder wrote: | Script provide by @FreeER already gave an answer and solution, just save this script as Lua file and save to CE autorun folder.
Code: | function openExe(...)
local before = getProcesslist()
shellExecute(...)
local after = getProcesslist()
for k,v in pairs(after) do
if not before[k] then return k,v end
end
end
local openedPID = openExe('notepad')
local MainOnClose = MainForm.OnClose
MainForm.OnClose = function(...)
shellExecute('taskkill', '/PID ' .. openedPID)
return MainOnClose(...)
end |
Or another version to do same process as above :
Code: | getLuaEngine().cbShowOnPrint.Checked=false
getLuaEngine().hide()
game_check_list = createStringlist()
function game_check()
getProcesslist(game_check_list)
local count = 0
for i=0,game_check_list.count-1 do
if game_check_list[i]:find("notepad") then
count = count + 1
end
end
if count > 1 then
showMessage("Can not identify game process. Use manual attach")
else
local path = 'C:\\Windows\\notepad.exe'
shellExecute(path) --- change to process name you wish to open
openProcess('notepad')
showMessage("Process found and opened")
return
end
game_check_list.clear()
end
function onCloseCE()
local id = getOpenedProcessID()
os.execute("taskkill -im "..id)
closeCE()
return caFree
end
game_check()
MainForm.OnClose = onCloseCE
|
save as a Lua file and place to CE autorun folder |
FreeER always skips these details
Giving a code and questions remain in the air!
The idea of throwing in the CE Autorun Folder makes sense.
Throughout the night, I tried other options for this detail.
I used the .bat script with the Trainer in the video.
Thanks for the explanation.
Everything I learned, I'm trying to move further.
I have more ways and it is an honor to be with you again.
Code: | FreeER: Thanks again for the code.
Thanks Corroder and DB.. |
https://www.youtube.com/watch?v=gvds9uFcHTw&t=0s&index=70&list=PL1yPHiegVpRoWx7jy6ecTqmbejos75O37
_________________
|
|
Back to top |
|
|
|