digitalmars.D.learn - How to open a webpage in D?
- Taylor Hillegeist (4/4) Aug 31 2015 I thought that perhaps spawing a process would work but
- Adam D. Ruppe (6/7) Aug 31 2015 Try the browse function from std.process:
- Taylor Hillegeist (2/9) Aug 31 2015 Browse is obviously the coolest solution. :)
- cym13 (14/18) Aug 31 2015 Use curl:
- Taylor Hillegeist (4/8) Aug 31 2015 Actually executeShell worked for me thanks for the reference to
I thought that perhaps spawing a process would work but execute("PATH TO HTML FILE",null,Config.none,size_t.max,dirName(exepath)); Didn't seem to work? any ideas?
Aug 31 2015
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote:I thought that perhaps spawing a process would work butTry the browse function from std.process: http://dlang.org/phobos/std_process.html#browse What it does is execute a browser process with the given argument. I think a filename will work as well as a url.
Aug 31 2015
On Monday, 31 August 2015 at 22:24:28 UTC, Adam D. Ruppe wrote:On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote:Browse is obviously the coolest solution. :)I thought that perhaps spawing a process would work butTry the browse function from std.process: http://dlang.org/phobos/std_process.html#browse What it does is execute a browser process with the given argument. I think a filename will work as well as a url.
Aug 31 2015
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote:I thought that perhaps spawing a process would work but execute("PATH TO HTML FILE",null,Config.none,size_t.max,dirName(exepath)); Didn't seem to work? any ideas?Use curl: void main(string[] args) { import std.stdio, std.net.curl, std.algorithm; "http://rosettacode.org/wiki/Web_scraping" .byLine .each!writeln; } compile with dmd -L-lcurl test.d See http://dlang.org/phobos/std_net_curl.html Also note that if you want to spawn a process you have to specify an executable, giving a HTML file as your example suggests wouldn't work.
Aug 31 2015
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist wrote:I thought that perhaps spawing a process would work but execute("PATH TO HTML FILE",null,Config.none,size_t.max,dirName(exepath)); Didn't seem to work? any ideas?Actually executeShell worked for me thanks for the reference to Std.process.
Aug 31 2015