[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference iosg::all-in-1_v30

Title:*OLD* ALL-IN-1 (tm) Support Conference
Notice:Closed - See Note 4331.l to move to IOSG::ALL-IN-1
Moderator:IOSG::PYE
Created:Thu Jan 30 1992
Last Modified:Tue Jan 23 1996
Last Successful Update:Fri Jun 06 1997
Number of topics:4343
Total number of notes:18308

666.0. "mail & cabinet functions in V3.0" by NEWOA::SUTTON (Schitzophrenic? Us?) Mon May 11 1992 18:48

G'day,

I'm having some problems with a piece of script for creating mails
which worked under V2.4 but fails in several places. The gist of 
the script is:-
	1. create mail
	2. set address/subject
	3. create a document
	4. attach the document to the mail

There appear to be two or three errors:-
	a) MAIL TO #target_address does not add address to message
	b) MAIL SUBJECT #doc_title does not add a subject
	c) CABINET ATTACH_DOCUMENT does not attach the doc to the mail

Can someone point out the problem, and are there any new V3.0 
Programming Manuals?

	Regards,

		  Jezza

The code...

oa$tra_set term,script,symbol
!----------------------------------------------------------------------
!Ph. aleton			11-oct-1989		
!17-jan-1990  modify the syntax to get device/name/extension/type
!             uk test
!
!----------------------------------------------------------------------

.label begin

.label start
get #document = OA$DIR:"SCO$$D_wrk:*.MRG".%NEXT[""] 
get #first = #document
.if #document eqs  "" then .goto FINISH_PROC
cabinet begin


.label loop

get #document_dev = OA$DIR:"*.*;*".dev[#document]
get #document_dir = OA$DIR:"*.*;*".dir[#document]
get #document_name = OA$DIR:"*.*;*".name[#document]
get #document_type = ".WPL"

get #document_title = #document_name:32:7
get #target_badge = #document_name:6
get #target_address = sco$bad_def.bad_address[#target_badge]

.if #target_address eqs "" then .goto next_doc

!
.label fil_doc

mail create/open/nosend/noedit
.if oa$status ne 1 then .abort

mail to #target_address			(1)

mail subject #document_title		(2)

mail close_message

cabinet refile_document ,"SCORE REPORTS"
.if oa$status ne 1 then .abort

cabinet add_attribute ,"FORMAT","STANDARD ASCII" 
cabinet add_attribute ,"KEYWORDS",#target_person
get #mail_doc = oa$curdoc
cabinet force

cabinet create "SCORE REPORTS", ".WPL", #cre_doc
.if oa$status ne 1 then .abort

cabinet add_attribute #cre_doc,"TITLE",#document_title
cabinet add_attribute #cre_doc,"FORMAT","WPSPLUS NO FMT" 
cabinet add_attribute #cre_doc,"DSAB","WPSPLUS" 
cabinet add_attribute #cre_doc,"KEYWORDS",#target_person

get #cre_file = cab$.filename[#cre_doc]
copy #document #cre_file			(3)
append "sco$$D_SCP:sco$blank.wpl" #cre_file
cabinet force

cabinet attach_document #mail_doc, #cre_doc	(4)
cabinet force
cabinet delete_document #cre_doc
cabinet force

.label next_doc

get #document_next = OA$DIR:"SCO$$D_wrk:*.MRG".%next[#document] 

.if #document_next eqs  "" then get #document = ""
.if #document_next eqs  "" then  .goto next_doc
.if #document_next eqs #first then .goto FINISH

get #document = #document_next
.goto LOOP

.LABEL FINISH
cabinet end

get oa$dcl = "delete/nolog sco$$d_wrk:*.mrg;*"

.label REALLY_FINISH
.label FINISH_PROC
 	.exit


(1) - no address appears on the resulting mail message even though 
	the symbol contains text (e.g. rallph llama @new)

(2) - no subject appears on the mail, even though the symbol
	contains text like REP_WK03_000002

(3) - the copy function works and the resulting document
	contains a valid message (actually a report)

(4) - the document containing the report is not attached to the
	mail message
T.RTitleUserPersonal
Name
DateLines
666.1Check the standard MAIL scripts for comparisonSHALOT::NICODEMWho told you I'm paranoid???Tue May 12 1992 14:367
	Those particular functions have not changed, and your script certainly
should work.  However, have you checked to see what the current drawer context
is?  Are you sure that you are set to the MAIN drawer when you are doing this?
If not, the mail will get created in a CREATED folder in whatever drawer you
are currently pointing to.

	F
666.2A small trace file might helpBUFFER::VICKERSRearranging the DEChairsTue May 12 1992 15:4739
    As .1 stated correctly, the functions in question have not changed in
    V3.  .1 made the assumption that the MAIL drawer was left as MAIN,
    however.  The proper way to check for the MAIL drawer is shown in this
    code segment (randomly taken from TMSCAN.SCP):

!+
! Switch to user's current mail drawer if necessary
!-
        GET #TM_PRVDWR = ""
        GET #TM_PRVMES = OA$CURMES
        .IF (OA$CURDWR_LOCATION NES OA$MAIL_DRAWER_LOCATION ) OR -
                (OA$CURDWR_REMOTE EQS OA$Y)
        .THEN
                GET #TM_PRVDWR = OA$CURDWR
                CABINET SET_DRAWER OA$MAIL_DRAWER
        .END_IF

    It's rather doubtful that the MAIL drawer is an issue in this case but
    this is the sort of thing that is likely to occur as more systems move
    to V3 and users create many drawers.

    The V3 documentation set is shipping so you should be able to order it
    through the normal channels.  Mine arrived last week.  The Bookreader
    version has been on the CD since March, I believe.  The availability
    over the network has been discussed at some length here and in A1INFO
    and I cannot remember whether it is available or not.

    You don't mention what sorts of things are happening at the four
    failure points in the script.  I notice that you have trace turned on. 
    In addition to getting the values of the #target_address,
    #document_title, #cre_file, and #cre_doc symbols it would be good to
    know the value of OA$STATUS at the four points as well.  You would need
    to add checks (or GETs) at those points.

    You might want to post a trace file for that section of the script
    starting at point (1) and going to point (4).

    Good luck,
    don
666.3IOSG::CARLINDick Carlin IOSG, Reading, EnglandTue May 12 1992 17:4113
    Just to clarify a bit. Although there may be good reasons for an
    application wanting to be in the default drawer, the MAIL functions will
    work in *any* local drawer (you can create mail, send it and so on). It
    is the mail UI that drags you into the default drawer to carry out mail
    operations.
    
    But Don is right. Applications may have to do more to work in a
    multi-drawer V3 environment.
    
    As to your original problem, it's a puzzler. Even if you have
    customisations it's difficult to see how they would cause what you are
    seeing. Are you sure those symbols are set up when you call the mail
    functions?