| $! This is a version of what you want, but it's not very sophisticated.
$! It merely submits a batch job, it's not a mail-server thing.
$!+
$! This command file will post a note (or several notes) to a notesfile (or
$! several notesfiles).
$! It will do it [for this version] by creating a self-submitting batch job
$! for each note/reply.
$!
$! This assumes that NOTES-11 is invoked with the symbol "Notes"
$!
$! Command line:
$! @post textfile notesfile [command [notenumber]]
$!
$! textfile
$! The name of a text file that contains the body of the note to write
$! or reply. A default of SYS$SCRATCH:.TXT is applied.
$! notesfile
$! The notesfile to post the note in. A default of SYS$NOTES:.NOT is
$! applied.
$! command
$! WRITE or REPLY. Default is WRITE.
$! notenumber
$! Only allowed if command is REPLY; this parameter is the NOTE number
$! to REPLY to. No checking is made for validity of this number in v1.
$! No guarantee is made that the REPLY will be to the correct note,
$! especially if a note that does not exist is specified.
$!-
$ ver = 'f$ver(0)' ! 'f$ver(post_debug)'
$ textfile_default = "SYS$SCRATCH:.TXT"
$ notesfile_default = "SYS$NOTES:.NOT"
$ if p1.eqs."" then read/end=alldone/prompt="$_Textfile: " sys$command p1
$ if p1.eqs."" then goto alldone
$ p1 = f$parse(p1,textfile_default)
$ if f$search(p1).eqs."" then goto no_textfile
$ if p2.eqs."" then read/end=alldone/prompt="$_Notesfile: " sys$command p2
$ if p2.eqs."" then alldone
$ p2 = f$parse(p2,notesfile_default)
$ if p3.eqs."" then p3 = "WRITE"
$ if (p3.nes."WRITE") .and. (p3.nes."REPLY") then goto bad_p3
$ p3 = p3+"_LABEL"
$ the_time = f$time() - "-" - "-" - ":" - ":" - "."
$ the_time = f$edit(the_time,"COLLAPSE")
$ the_pid = f$getj("","PID")
$ the_user = f$getj("","USERNAME")
$ goto 'p3'
$!
$WRITE_LABEL:
$!
$ command_file_name = "SYS$SCRATCH:WRITE_"+the_pid+"_"+the_time+".COM"
$ read/prompt="$_note Title? " sys$command note_title
$ open/write comfile 'command_file_name'
$ write comfile "$! This command file will WRITE ''p1' to notesfile ''p2'"
$ write comfile "$ on error then goto resubmit"
$ write comfile "$ Notes notes ''p2'"
$ write comfile "write ''p1'"
$ write comfile "''note_title'"
$ write comfile "Y"
$ write comfile "exit"
$ write comfile "$ set noon ! In case we can't delete or mail"
$ write comfile "$ delete ''command_file_name';"
$ write comfile "$ mail nl: ''the_user'/sub=""''p1' written to ''p2'."""
$ write comfile "$ exit"
$ write comfile "$resubmit:"
$ write comfile "$ sub=""sub/nonoti/keep/after=tom/noprint/log=sys$scratch:/que=sys$netcopy"""
$ write comfile "$ sub/name=""Post_WRITE"" ''command_file_name'"
$ write comfile "$ exit"
$ close comfile
$ sub="sub/nonoti/keep/noprint/log=sys$scratch:/que=sys$netcopy"
$ sub/name="Post_WRITE" 'command_file_name' !/after=tom
$ exit
$!
$REPLY_LABEL:
$!
$ command_file_name = "SYS$SCRATCH:REPLY_"+the_pid+"_"+the_time+".COM"
$ read/prompt="$_note number to reply to [1]? " sys$command note_number
$ open/write comfile 'command_file_name'
$ write comfile "$! this command file will use ''p1' as a reply to note #''note_number' of notesfile ''p2'"
$ write comfile "$ on error then goto resubmit
$ write comfile "$ notes notes ''p2'"
$ write comfile "''note_number'"
$ write comfile "reply ''p1'"
$ write comfile "Y"
$ write comfile "exit"
$ write comfile "$ set noon ! In case we can't delete or mail"
$ write comfile "$ mail nl: ''the_user'/sub=""''p1' used as reply to ''note_number' in ''p2'"""
$ write comfile "$ delete ''command_file_name';"
$ write comfile "$ exit"
$ write comfile "$resubmit:"
$ write comfile "$ sub=""submit/noprint/keep/log=sys$scratch:/after=tom/que=sys$netcopy"""
$ write comfile "$ sub/name=""Post_REPLY"" ''command_file_name'"
$ write comfile "$ exit"
$ close comfile
$ sub="sub/nonoti/keep/noprint/log=sys$scratch:/que=sys$netcopy"
$ sub/name="Post_REPLY" 'command_file_name' !/after=tom
$ exit
$!
$! Error handlers:
$!
$No_textfile:
$ write sys$output "Can't find ''p1'"
$ goto alldone
$
$bad_p3:
$ write sys$output "Only WRITE or REPLY allowed as p3"
$ goto alldone
$
$alldone:
$ ver = f$ver(ver)
|