www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to open a webpage in D?

reply "Taylor Hillegeist" <taylorh140 gmail.com> writes:
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
next sibling parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Monday, 31 August 2015 at 22:21:20 UTC, Taylor Hillegeist 
wrote:
 I thought that perhaps spawing a process would work but
Try 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
parent "Taylor Hillegeist" <taylorh140 gmail.com> writes:
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:
 I thought that perhaps spawing a process would work but
Try 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.
Browse is obviously the coolest solution. :)
Aug 31 2015
prev sibling next sibling parent "cym13" <cpicard openmailbox.org> writes:
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
prev sibling parent "Taylor Hillegeist" <taylorh140 gmail.com> writes:
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