Hi, I'm using LyX 2.0.5.1 on a Windows 7 machine.
I am trying to put together a LyX framework that will allow me to enter some text, set it to a particular Style, and for the text marked by that Style to be written to a file. The filename and path to be specified by other macros. The file created would then be included in my document. (In the interest of brevity I won't go into why I would like to do this.) With the implementation detailed below, I get an error when I generate the PDF document: ! I can't write on file `c:/docs/test.tex'. I have verified that I can generally create files in the c:/docs directory, so I don't think it's a permissions or existence issue. I wonder if it's to do with Windows-style path names? So for example I have this in my document (this is the source that LyX shows for the text I've entered with Styles): \filepath{c:/docs/} \filename{test} \filebody{This is the text that should be put into the file} I've defined this in my document class: \newcommand\filename[1]{\renewcommand\filename{#1}} \newcommand\filepath[1]{\renewcommand\filepath{#1}} \newcommand\filebody[1]{ \newwrite\tempfile \immediate\openout\tempfile=\filepath\filename \immediate\write\tempfile{\filename: #1} \immediate\closeout\tempfile \input{\filepath\filename} } And in my layout file I have: Style FileName LatexType Command LatexName filename End Style FileBody LatexType Command LatexName filebody End Style FilePath LatexType Command LatexName filepath End Any thoughts about what's going on would be gratefully received. Thanks in advance, Steve