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 


checkbox logic (to close app when checkbox unchecked)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Jan 16, 2017 12:06 am    Post subject: checkbox logic (to close app when checkbox unchecked) Reply with quote

Hi there,

Code:
function proApp(sender)
 if TrainerOrigin~=nil then
 path=TrainerOrigin
 else
 path=getCheatEngineDir()
 end
 if string.sub(path,#path, #path)~="\\" then
 path=path.."\\"
 end
 shellExecute(path.."1by1.exe")
 if sender.unChecked then
 autoAssemble[[alloc(p,64)
 createthread(p)
 p:
 push 0
 call exitProcess
 ret]]
 end
end

UDF1.CECheckbox1.onChange = proApp


1. When checkbox checked, it execute "1x1.exe"
2. When checkbox unchecked, it execute "1x1.exe" again

How to close "1x1.exe" when checkox unchecked ?

Thank and regards
Back to top
View user's profile Send private message
Zanzer
I post too much
Reputation: 126

Joined: 09 Jun 2013
Posts: 3278

PostPosted: Mon Jan 16, 2017 12:48 am    Post subject: Reply with quote

Code:
shellExecute("taskkill", "/IM 1x1.exe /F")
Back to top
View user's profile Send private message
panraven
Grandmaster Cheater
Reputation: 55

Joined: 01 Oct 2008
Posts: 942

PostPosted: Mon Jan 16, 2017 12:55 am    Post subject: Reply with quote

There should be no .unChecked property.
Try check .Checked or .State vs cbGrayed etc.

btw, closing application externally may not allow a chance for the application properly exit, eg. lost of game progress.

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Jan 16, 2017 2:33 am    Post subject: Reply with quote

Ok, thanks both of you Zanzer and panraven

SOLVED :

Code:
function proApp(sender)
 if TrainerOrigin~=nil then
  path=TrainerOrigin
 else
  path=getCheatEngineDir()
 end

 if string.sub(path,#path, #path)~="\\" then
  path=path.."\\"
 end

 boxstate = checkbox_getState(UDF1.CECheckbox1)

 if boxstate == 1  then
   shellExecute(path.."1by1.exe")
 elseif boxstate == 0  then
   shellExecute("taskkill", "/IM 1by1.exe /F")
 end

end

UDF1.CECheckbox1.onChange = proApp


regards
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