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() |
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") execute('/usr/bin/xpdf ' .. input.value .. ".pdf") 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 view = Button{200,40,70,25,"&View"} function view: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 edit = Button{270,40,70,25,"&Edit"} function edit: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() |