Author Topic: Execute EXE file on computer while playing  (Read 2471 times)

0 Members and 1 Guest are viewing this topic.

Offline coffeesoft

  • 28
  • Bip Bip
Execute EXE file on computer while playing

 Hi, i wanted to ask if someone knows if is possible to execute a EXE file stored on the computer while playing, for example when a enemy arrives or whatever.

Thanks.

 

Offline The E

  • He's Ebeneezer Goode
  • Global Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Execute EXE file on computer while playing
Before I answer this, let me ask: What do you want to do?
Let there be light
Let there be moon
Let there be stars and let there be you
Let there be monsters and let there be pain
Let us begin to feel again
--Devin Townsend, Genesis

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing

 I want to use AutoHotKey and run some scripts to turn on lights, display messages... for example.

I learned to program this tool a little and wanted to do some testing if possible  :)

 

Offline The E

  • He's Ebeneezer Goode
  • Global Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Execute EXE file on computer while playing
Ah. That seems much more reasonable than what I feared you wanted to do :)

The answer is simple. Just use
Code: [Select]
os.execute("Your command here")
Let there be light
Let there be moon
Let there be stars and let there be you
Let there be monsters and let there be pain
Let us begin to feel again
--Devin Townsend, Genesis

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing

 Thanks   :p

Questions.

- Where i put the EXE file, inside mod folder ?

- Wich OS command i must use to launch the file ?


Something like that would work ?

Code: [Select]
#Conditional Hooks
$Version: 3.7
$On Game Init:

Graphics.setColor(255, 255, 255)
Graphics.drawString("Running EXE !", 5, 10)

os.execute("Script1.exe")

]
+Override: YES
#End



 

Offline m!m

  • 211
Re: Execute EXE file on computer while playing
The answer is simple. Just use
Code: [Select]
os.execute("Your command here")
Unfortunately, that will not work. FSO disables that command for security reasons but I guess a command line option could be added to allow using those functions.

 

Offline The E

  • He's Ebeneezer Goode
  • Global Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Execute EXE file on computer while playing
Right.
Let there be light
Let there be moon
Let there be stars and let there be you
Let there be monsters and let there be pain
Let us begin to feel again
--Devin Townsend, Genesis

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Execute EXE file on computer while playing
Why can't you just have an autohotkey script running concurrently that detects something scripts can do?
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing
Quote
Unfortunately, that will not work. FSO disables that command for security reasons but I guess a command line option could be added to allow using those functions.

:(  out of curiosity, wich reasons ?, i mean, Can we format our HDs while playing ?  :D


Quote
Why can't you just have an autohotkey script running concurrently that detects something scripts can do?

I don´t know how to communicate both scripts, my knowledge about this is very limited....

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Execute EXE file on computer while playing
Can't you pass messages to scripts somehow?  I mean, a quick Google turned up this (topic is Lua scripting and AHK):  https://autohotkey.com/board/topic/6894-running-another-program-then-retrieving-a-value/

At the worst, maybe you could alter the contents of the file, and have AHK poll that file?

But I think the other guys here will have much better ways of implementing whatever you're wanting to accomplish.

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing

 I don't know if I understood correctly

 - Can FSO store some data of the mission in a custom txt file ?, for example, wing 1 arrives = true or false

So we could read those data with AHK

 
Re: Execute EXE file on computer while playing
Quote
Unfortunately, that will not work. FSO disables that command for security reasons but I guess a command line option could be added to allow using those functions.

:(  out of curiosity, wich reasons ?, i mean, Can we format our HDs while playing ?  :D

If you can execute outside executables from within a game's code, you basically own the player's computer. It's that simple. It's a big security hole.
The good Christian should beware of mathematicians, and all those who make empty prophecies. The danger already exists that the mathematicians have made a covenant with the devil to darken the spirit and to confine man in the bonds of Hell.

 

Offline m!m

  • 211
Re: Execute EXE file on computer while playing
To be honest, FSO is not written with security in mind. I'm pretty sure that you could find a lot of possible attacks even without using scripts but a script is a very easy attack so we might as well try to reduce the attack surface by restricting what a script can do.

 

Offline The E

  • He's Ebeneezer Goode
  • Global Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Execute EXE file on computer while playing
Plus, the people who have used scripting to address other things external to FSO have used TCP/IP or other mechanisms to achieve their goals.
Let there be light
Let there be moon
Let there be stars and let there be you
Let there be monsters and let there be pain
Let us begin to feel again
--Devin Townsend, Genesis

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Execute EXE file on computer while playing

 I don't know if I understood correctly

 - Can FSO store some data of the mission in a custom txt file ?, for example, wing 1 arrives = true or false

So we could read those data with AHK

I don't know, someone else will have to answer that.

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing
Quote
I don't know, someone else will have to answer that.

Would be great, i know how to read data of a txt file with AHK.

 

Offline jr2

  • The Mail Man
  • 212
  • It's prounounced jayartoo 0x6A7232
    • Steam
Re: Execute EXE file on computer while playing
Quote
I don't know, someone else will have to answer that.

Would be great, i know how to read data of a txt file with AHK.

If you can tell us what the purpose is, there might be a better way around it through scripting or something.  I'm assuming you're making a mod of some type?  Just tell us what exactly you're attempting to do, or PM a scripting guru (ask who to PM) if you want to keep it secret until launch.  Or you could ask on the HLP Discord server (you don't have to install anything if you really don't want to, it will load in a browser just fine).

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing

I have no problem to explain my purposes  :)

In a first time, I thought the content of the EXE was not relevant to the question.

I like to play with the script of PoDo, i mean using a secondary computer to visualize the data of the game, that allows you to remove almost everything from the main screen, plus playing with three displays, gives us a great space of vision and a nice feeling.

I'm interested in switch on-off real lights together with the PoDo script, but my knowledge of programming is really limited, Arduino is "easy" to program, a nice option, but i don´t know how to FSO and Arduino can talk.

Actually there is not much progress on that scripts, so I wanted to try other ways, and is the reason that i want to try with AutoHotKey, because i learned a bit how to program.

My idea was to do some tests, when  I get some data from FSO and launch an EXE.

I hope it is more or less well explained, sorry about my poor english  :p

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Anims: 420, Cutscenes: 10, Mainhalls: 7, Logos: 52
    • Steam
    • Twitter
    • Mix-Hai Productions
Re: Execute EXE file on computer while playing

 I don't know if I understood correctly

 - Can FSO store some data of the mission in a custom txt file ?, for example, wing 1 arrives = true or false

So we could read those data with AHK

I don't know, someone else will have to answer that.

Yes, FSO scripts can write text files. How do you think the checkpoint script works? :) I even used the ability to open/write text files to hide/unlock bonus missions in BtA.
Cutscene Upgrade Project - Mainhall Remakes - MixaelANITools - Between the Ashes - MjnMixael's Render Boutique - Mix-Hai Productions
Youtube Channel - P3D Model Box - Photobucket Albums - Model Releases - Downloads
Between the Ashes is looking for committed testers, PM me for details.
Report MediaVP issues, now on the MediaVP Mantis! Read all about it Here!

 

Offline coffeesoft

  • 28
  • Bip Bip
Re: Execute EXE file on computer while playing
Quote
Unfortunately, that will not work. FSO disables that command for security reasons but I guess a command line option could be added to allow using those functions.

It would be great  :nod:

Quote
Yes, FSO scripts can write text files. How do you think the checkpoint script works? :) I even used the ability to open/write text files to hide/unlock bonus missions in BtA.

Can you point me in the right direction ?, some example ?