Zethrax Posted July 25, 2015 Share Posted July 25, 2015 Hi. Is there any way in either the Leadwerks engine or the Lua implementation to open a webpage URL in the user's default web browser. Basically I'm looking to shell execute a URL. For example, in Blitz3D I can use the code:- Execfile "http://www.leadwerks.com/" to shell execute the specified URL which will open the webpage in the user's default web browser. In a project for a free advergame I'm working on in Blitz3D I have a couple of main menu links to open the game project's website and to open the website for the advertised product. I'm considering porting that project to Leadwerks, but if I can't open a webpage from my program then it ends up being a deal killer for an advertising supported game. Quote Link to comment Share on other sites More sharing options...
Josh Posted July 25, 2015 Share Posted July 25, 2015 No, but if you look in the BMX module you can find how to do it: int bbOpenURL( BBString *url ){ int n; if( _usew ){ n=(int)ShellExecuteW( 0,0,(wchar_t*)bbTmpWString(url),0,0,10 )>32; //SW_SHOWDEFAULT }else{ n=(int)ShellExecuteA( 0,0,bbTmpCString(url),0,0,10 )>32; //SW_SHOWDEFAULT } return n; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
macklebee Posted July 25, 2015 Share Posted July 25, 2015 You can use lua's os.execute on a html file that would use the default browser to open it. The html file can have the links to the actual website... its a dirty workaround but it works. Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Zethrax Posted July 26, 2015 Author Share Posted July 26, 2015 OK, thanks for the info. I'll do some experimenting with the suggested methods. Quote Link to comment Share on other sites More sharing options...
beo6 Posted July 26, 2015 Share Posted July 26, 2015 If that does not work, you can try to call it with a lua library. i made a small one with some additional functions. (was mostly just playing around with it) Have uploaded it for you here: https://cloud.software-sl.de/index.php/s/JLiv6hkd9koCLms You have to extract the files where your executable is and add import("LEAddon.lua") to your App.lua or Main.lua at the beginning. Then you can call something like addon.Execute("http://www.google.de") and the default browser is started. It has a couple of other functions but as i said i where mostly playing around with it and not everything will work. You will have to disable sandbox Lua though. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.