Running Windows Application From It's Start In Path
Hey all. I'm creating a simple remote on my new streaming machine. It has 4 functions, to start/stop OBS, to manually trigger Boom Replay, to start OBS (after first running a taskkill command to terminate it if it's running) and finally, to do the same thing with ScorpBot.
I'm using the os.start commmands to execute both OBS and ScorpBot on those functions. The problem is, it doesn't appear to be executing those applications from the paths that you would find in the "Start In" field in the shortcut properties. In both cases, this causes them to fail to run because they can't find their configuration files.
I've looked at the documentation and I can't find anything that clearly states how I can ensure these applications are executed from within their starting paths. Is there a way to do this? Or do I just have to write a batch file for each that changes to the directory before executing the application? This seems like a relatively simple problem to solve and yet I can't find an answer.
I have not built a remote that simply opens a program.
But I have some that open a file using a specific program which naturally opens it in its own folder path.
[email protected] Start VLC actions.start_vlc = function() os.open("C:/Users/David/Desktop/Maria T Video/Music stands Instant Start/Music stands.xspf"); end [email protected] Run Premiere QT MariaT actions.start_premiere = function() os.open("C:/Users/David/Desktop/Maria T Video/Maria T Quad Split.prproj"); end`
You will see that the path needs to be contained within quotes (because of spaces in the path name) and uses "forward" slashes instead of "back" slashes.
Slashes and spaces are the most common problems.
Hi there and thanks for replying!
Unfortunately, OBS and ScorpBot don't have associated files so I can't launch them with the method you have here. What I need to do is have the applications launch from within their installed folders but the problem is that by default, os.open doesn't seem to change to the folder of the program it's being launched to run before it does so. I'm not sure if there's a way around this, beyond maybe writing batch files for each of the launches and executing those instead?
So, just using batch files actually did the trick. More than happy with this as a solution. Thanks!