newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: cormullion on December 09, 2008, 09:29:23 AM

Title: open a file in a browser from a newLISP script
Post by: cormullion on December 09, 2008, 09:29:23 AM
I've written this for running on MacOS X:


(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?
Title: Re: open a file in a browser from a newLISP script
Post by: DrDave on December 09, 2008, 11:54:16 AM
Quote from: "cormullion"I've written this for running on MacOS X:


(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?


(set 'filename-with-path "c:/myhtmlfile.html")
(exec filename-with-path)

or more like your example
(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
(set 'path "c:/" 'filename {"my html file"})
(exec (string path filename ".html"))
Title:
Post by: cormullion on December 09, 2008, 02:41:44 PM
Thanks.