Page 1 of 1

open a file in a browser from a newLISP script

Posted: Tue Dec 09, 2008 5:29 pm
by cormullion
I've written this for running on MacOS X:

Code: Select all

(if (= ostype "OSX") 
    (exec (string "open " file ".html")))
which displays the file.html file in the default web browser. Is there an equivalent form for Windows?

Re: open a file in a browser from a newLISP script

Posted: Tue Dec 09, 2008 7:54 pm
by DrDave
cormullion wrote:I've written this for running on MacOS X:

Code: Select all

(if (= ostype "OSX") 
    (exec (string "open " file ".html")))
which displays the file.html file in the default web browser. Is there an equivalent form for Windows?

Code: Select all

(set 'filename-with-path "c:/myhtmlfile.html")
(exec filename-with-path)
or more like your example

Code: Select all

(set 'path "c:/" 'filename "myhtmlfile")
(exec (string path filename ".html"))
Beware of spaces in the filename; you'll need to wrap the string like this

Code: Select all

(set 'path "c:/" 'filename {"my html file"})
(exec (string path filename ".html"))

Posted: Tue Dec 09, 2008 10:41 pm
by cormullion
Thanks.