How do you correctly use os.start on tap?
I would say I'm relatively experienced with Lua and Unified Remote custom remotes, but am pulling my hair out at the simple code below that won't run:
actions.flux_launch = function() os.start("%UserProfile%\\AppData\\Local\\FluxSoftware\\Flux\\flux.exe"); end
<?xml version="1.0" encoding="utf-8"?> <layout onlaunch="launch"> <row> <button text="Launch Flux" ontap="flux_launch" /> </row> </layout>
FYI the full path is:
When I tap the button on my phone, nothing happens. I've used os.start several times on other remotes with success but not this one. When I enter the full path in Windows Explorer, the program launches immediately. I've also tried the full path instead of %UserProfile% with no luck.
What am I missing?
I have always used os.open because I am looking to open a particular file, but I imagine its the same....
and I have always used the full path, but I imagine %userprofile% should work.
I think you need single forward slashes like this........ probably because it is just passing the command to the os....
actions.flux_launch = function() os.start("%UserProfile%/AppData/Local/FluxSoftware/Flux/flux.exe"); end
Wow thanks for responding so soon! I spent a good half-hour writing a detailed response about how I tried os.open, forward slashes, experimenting with different exe files, testing from the root directory, etc.. when suddenly the original code worked.
For 2 hours I'd been having no luck, 99% sure my code was right and at my wit's end. Now it just decides to work.
For what it's worth, I did try all you suggested though. For the record:
- Using single forward slashes (in this specific scenario) worked just fine!
- Using os.open didn't work for the exe
Thanks for the help :)
Yes, os.open opens a file, using the extension (needs to be registered in the os already) to determine the executable. os.start opens the program only.
Glad I could help!