Hard Light Productions Forums
Modding, Mission Design, and Coding => The Scripting Workshop => Topic started by: coffeesoft on October 21, 2017, 06:45:04 am
-
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.
-
Before I answer this, let me ask: What do you want to do?
-
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 :)
-
Ah. That seems much more reasonable than what I feared you wanted to do :)
The answer is simple. Just use
os.execute("Your command here")
-
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 ?
#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
-
The answer is simple. Just use
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.
-
Right.
-
Why can't you just have an autohotkey script running concurrently that detects something scripts can do?
-
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
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....
-
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.
-
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
-
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.
-
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.
-
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.
-
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.
-
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.
-
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 (https://is.gd/I73Mr9) (you don't have to install anything if you really don't want to, it will load in a browser just fine).
-
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
-
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.
-
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:
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 ?