reidar
Group: Members
Posts: 92
Joined: Sep. 2004 |
|
Posted: Mar. 09 2005,09:24 |
|
I have made some suggestions for the DSL MSDoc converter/viewer, which includes a button for 'Edit'. This button converts the word-document into pure text and opens it up in the beaver text-editor. There you can edit the text, rewrite it and save it as a new document. Now, I would like to use Scite instead of Beaver here, because Scite can export text to RTF and HTML (the latter can be opened in FlWriter, the former in any wordprocessor), but I guess that is hard since Scite only exists as an extension now... (For which I am very sad by the way. I think Scite is far better than Beaver, although Beaver has a nice look.)
Here is my suggestion for new coding of wordview.lua (please bear with me, since this is my first attempt at working with lua. There might be errors in my coding, but it worked fine for me, so...):
Quote | #!/bin/flua -- © 2005 Robert Shingledecker -- GUI front end to Word viewer
function data_check() if input.value == "" then return nil end local file_check = openfile(input.value,"r") if not file_check then return nil end return "" end
function convertFile() convertWin = Window{140,50,"Convert"} convertBox = Box{4,8,140,1; label=[[Pdf or Postscript?]]} pdfBtn = Button{0,25,70,25,"P&df"} function pdfBtn:callback() execute('/usr/bin/antiword -p a4 ' .. input.value .. ' > '.. input.value .. ".ps") execute('/usr/local/bin/ps2pdf ' .. input.value .. ".ps") remove(input.value .. ".ps") exit(0) end psBtn = Button{70,25,70,25,"&Ps"} function psBtn:callback() execute('/usr/bin/antiword -p letter ' .. input.value .. ' > '.. input.value .. ".ps") exit(0) end convertWin:end_layout() convertWin:show() end
w = Window{400,75,"MSDoc Convert/Viewer"} input = Input{100,10,210,25,"File:"}
help = Button{60,40,70,25,"&Help"} function help:callback() w = Window{300,85,"Help"} box = Box{3,3,298,83,[[ DSL Word doc file Convert Viewer Utility. It can directly view a doc file or convert to Postscript.]]} box.box = Boxtype.up box.labelfont = Font.bold w:show() end
convert = Button{130,40,70,25,"&Convert"} function convert:callback() if data_check() then convertFile() else write(strchar(7)) flush() end end
edit = Button{200,40,70,25,"&View"} function edit:callback() if data_check() then workfile = tmpname() execute('/usr/bin/antiword -p a4 ' .. input.value .. ' > ' .. workfile) execute('/usr/local/bin/gvu -geometry 800x600 ' .. workfile) remove(workfile) exit(0) else write(strchar(7)) flush() end end
view = Button{270,40,70,25,"&Edit"} function view:callback() if data_check() then workfile = tmpname() execute('/usr/bin/antiword ' .. input.value .. ' > ' .. workfile) execute('/usr/bin/beaver ' .. workfile) remove(workfile) exit(0) else write(strchar(7)) flush() end end
w:end_layout() w:show() |
As you can also see I couldn't resist changing the format of ps/pdf to a4 over letter, but that is just because I am Norwegian and a4 is our standard format...
-r
|