--- In [email protected], "ariegilbert" <[EMAIL PROTECTED]> wrote:
>
> How can I do the following:
> 
> I have a legacy DOS program that wants to print to a LPT port. I
> cannot capture the port on an XP machine, so I have to find a
> work around. the windows "net use..." command did not work; the
> program not sensing a port cancels the send through, though it
> still does the following The program simultaneously creates a
> .txt file of the output to facilitate reprinting of the same
> output, I thought about some sort of script that would detect a
> new "file.txt" and then send it to the printer of my choice. can
> anyone be so kind as to help? 


Try the following script.

Regards,
Sheri

Function StartWatch()
static hwf
static wf
if (hwf !=="") do
  local ans=messagebox("YesNo Question", ;;+
  "Currently Watching:\n"++wf++"\n\nQuit watching?", ;;+
  case("Title", ScriptName))
  if (ans==6) do
    file.endwatchfolder(hwf)
    hwf=""
    quit
  endif
else
messagebox("OK", "Select a folder to watch",case("Title",Scriptname))
if (wf=="")
  wf=env("userprofile")++?"\My Documents"
wf=inputfolder(wf)
if (wf=="")
  quit
watchit()
endif
quit

Function Watchit()
static wf
static hwf=file.watchfolder(wf, cbx("@printit"), "", ;;+
"file lastwrite size")
messagebox("OK", "Now Watching "++wf++".",case("Title", ScriptName))
quit

Function Printit()
local chgfolder=_folder_
local chgfile=_file_
static hwf
if (file.validpath(chgfolder++?"\"++chgfile)) do
  local pq=messagebox("YesNo Question","Do you want to print " ;;+
  ++chgfile++" Now?",case("Title",Scriptname))
  If (pq==6) do
    local printers=win.getprinters()
    local printerv=vec.createfromlines(printers)
    local choice=printerv.showmenu()
    if (choice>-1) do
      local choice=printerv[choice]
      win.setdefaultprinter(choice)
      file.doverb(chgfolder++?"\"++chgfile, "Print", 1)
    endif
  endif
endif
hwf=""
Watchit()
quit




Reply via email to