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 


How run game's executable file from CE 6.1 trainer?
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Shahryar
Advanced Cheater
Reputation: 0

Joined: 11 Jun 2011
Posts: 85

PostPosted: Mon Jun 13, 2011 4:22 pm    Post subject: Reply with quote

Quote:
io.popen takes two params:
1.) File to launch.
2.) Access flags.

For example if you want to read from the launched process:
local filehandle = io.popen( "C:\\somefolder\\someapp.exe", "r" );


I don't know what to do. by it code can launch a game' executable file?
my script for launch game is:
Code:
function LaunchClick()
filetolaunch=openDialog_execute(Trainer_OD)
if filetolaunch~='' then
io.popen( filetolaunch, "r" );
end
end

and i don't know why its not worked. Sad
can you help me? Question
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Mon Jun 13, 2011 5:24 pm    Post subject: Reply with quote

and you're sure that that exe is the same exe as the shortcut on your desktop?
E.g: It could be there is a launcher.exe which actually starts the game

_________________
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
View user's profile Send private message MSN Messenger
Shahryar
Advanced Cheater
Reputation: 0

Joined: 11 Jun 2011
Posts: 85

PostPosted: Mon Jun 13, 2011 5:34 pm    Post subject: Reply with quote

Dark Byte wrote:
and you're sure that that exe is the same exe as the shortcut on your desktop?
E.g: It could be there is a launcher.exe which actually starts the game


I'm sure.
the game have one executable file. when i try to run the game by shellExecute(), I'm faced with this problem but when i run trainer and run the game with double click on the shortcut, i haven't any problem and the game work correctly.
As i said before i just in some games I'm faced with this problem.
If you can give me another code that does this code work.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Mon Jun 13, 2011 8:20 pm    Post subject: Reply with quote

Right-click the shortcut and choose 'Properties'. Check the paths to see if there are any extra arguments you need to pass for the game to even open.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Shahryar
Advanced Cheater
Reputation: 0

Joined: 11 Jun 2011
Posts: 85

PostPosted: Tue Jun 14, 2011 5:51 am    Post subject: Reply with quote

Wiccaan wrote:
Right-click the shortcut and choose 'Properties'. Check the paths to see if there are any extra arguments you need to pass for the game to even open.


Look at the photo, there is nothing to do. I know what you're looking for, but there is nothing there.



Properties.jpg
 Description:
 Filesize:  125.08 KB
 Viewed:  23545 Time(s)

Properties.jpg


Back to top
View user's profile Send private message Send e-mail Visit poster's website
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Jun 14, 2011 8:19 am    Post subject: Reply with quote

popen doesn't seem to launch the file but rather suspend it in memory.

You can use createProcess if you want to have CE load the file and auto-attach to it for you though.

For example:
Code:
createProcess( "C:\\Windows\\system32\\winmine.exe" );

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Shahryar
Advanced Cheater
Reputation: 0

Joined: 11 Jun 2011
Posts: 85

PostPosted: Tue Jun 14, 2011 10:24 am    Post subject: Reply with quote

Wiccaan wrote:
popen doesn't seem to launch the file but rather suspend it in memory.

You can use createProcess if you want to have CE load the file and auto-attach to it for you though.

For example:
Code:
createProcess( "C:\\Windows\\system32\\winmine.exe" );


I do not want the code for CE. I want the code for the trainer. Does this code also work?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Jun 14, 2011 10:52 am    Post subject: Reply with quote

I don't know if createProcess() works in trainers as I don't use the CE trainer maker. shellExecute() should work fine as long as you pass the full path properly.

For example:
Code:
shellExecute( "C:\\some_folder\\some_file.exe" );


Works fine for me. As for openDialog_execute, it doesn't appear that DB exposed any method to create a dialog yet. Looking at the source, it expects a dialog object since it casts back from a userdata object but there isn't a way to construct a FileDialog yet.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Tue Jun 14, 2011 11:19 am    Post subject: Reply with quote

opendialog gets created if you put it on a form (it's a lot easier to configure a opendialog using the property editor as well)
_________________
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
View user's profile Send private message MSN Messenger
Shahryar
Advanced Cheater
Reputation: 0

Joined: 11 Jun 2011
Posts: 85

PostPosted: Tue Jun 14, 2011 11:23 am    Post subject: Reply with quote

How can this code be used to run exe file?
Code:
io.popen()
Back to top
View user's profile Send private message Send e-mail Visit poster's website
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Jun 14, 2011 11:44 am    Post subject: Reply with quote

IRON SOFT wrote:
How can this code be used to run exe file?
Code:
io.popen()


Think of popen as a command line.
You can start another process using things like:

Code:
local f = io.popen( '"C:\\some_folder\\some_file.exe"', "r" );


Given that a command window will stay open during the duration of that files handle being valid. (Lua launches the other process separately.)

You are better off sticking to shellExecute though.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Shahryar
Advanced Cheater
Reputation: 0

Joined: 11 Jun 2011
Posts: 85

PostPosted: Tue Jun 14, 2011 12:26 pm    Post subject: Reply with quote

Wiccaan wrote:
Think of popen as a command line.
You can start another process using things like:

Code:
local f = io.popen( '"C:\\some_folder\\some_file.exe"', "r" );



Given that a command window will stay open during the duration of that files handle being valid. (Lua launches the other process separately.)

You are better off sticking to shellExecute though.


The code worked very well but I had a question.
How can I make this code placed in the following code?
Code:
function LaunchClick()
filetolaunch=openDialog_execute(Trainer_OD)
if filetolaunch~='' then
local f = io.popen( ????, "r" );
end
end


Last edited by Shahryar on Tue Jun 14, 2011 1:14 pm; edited 2 times in total
Back to top
View user's profile Send private message Send e-mail Visit poster's website
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Jun 14, 2011 12:59 pm    Post subject: Reply with quote

Dark Byte wrote:
opendialog gets created if you put it on a form (it's a lot easier to configure a opendialog using the property editor as well)


Just throws access violations for me.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Dark Byte
Site Admin
Reputation: 458

Joined: 09 May 2003
Posts: 25288
Location: The netherlands

PostPosted: Tue Jun 14, 2011 1:19 pm    Post subject: Reply with quote

wiccaan:
remember that the name of the opendialog object will be formname+opendialog (check if it's nil or not)

and then you can show it using openDialog_execute(formname_dialogname)

iron soft:
Try:
local f = io.popen( filetolaunch, "r" );
or
local f = io.popen( '"'..filetolaunch..'"', "r" );

_________________
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
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8517
Location: 127.0.0.1

PostPosted: Tue Jun 14, 2011 1:40 pm    Post subject: Reply with quote

Dark Byte wrote:
wiccaan:
remember that the name of the opendialog object will be formname+opendialog (check if it's nil or not)

and then you can show it using openDialog_execute(formname_dialogname)


Yeah, I did. It's still throwing access violations regardless. I'm trying it through the raw Lua panel as well as the editor. With the editor I'm doing:

1. Open CE -> Generate Trainer
2. Rename form to something noticable such as frmExampleTrainer
3. Create a button and name it btnLaunch.
4. Create an OpenDialog and name it odExampleTrainer.
5. Set the onClick even using ... twice to open the editor and create the event.
6. Set the code as the following for the click event:
Code:

function btnLaunchClick(sender)
    local child1 = control_getParent( sender ); -- button to panel
    local child2 = control_getParent( child1 ); -- panel to form

    if( frmExampleTrainer_odExampleTrainer == nil ) then
        print( "its nil" );
    end

    local dlg = openDialog_execute( "frmExampleTrainer_odExampleTrainer" );
end


Which just throws an access violation on the openDialog_execute. I did the getParent method just to ensure it was getting the correct name for the form. Manually entering the name doesn't help.

The check works fine, and printing out info on the object works so it is valid, but the dialog still fails.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
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