home *** CD-ROM | disk | FTP | other *** search
Wrap
/* $VER: InsertSignature.rexx 1.0d (19.07.96) Copyright 1996 SoftLogik Publishing Corporation May not be distributed without SoftLogik Publishing Corporation's express written permission */ OPTIONS RESULTS ADDRESS 'PAGESTREAM' sScriptName = 'Insert Signature' sSigFile = "PageStream3:Scripts/TextClips/SignatureBlock.txt" /* MAIN LOOP */ call OPENLIBS() if ~exists(sSigFile) then iTemp = getsignature() if iTemp ~= 9 then do call insertsignature() 'textcursor right' end EXIT INSERTSIGNATURE: /* INSERT THE SIGNATURE BLOCK */ 'inserttext convertquote true convertdash true linehaslf false textcode "" amiga file 'sSigFile' filter Ascii nostatus' RETURN GETSIGNATURE: /* PRINT SIGNATURE REQUESTER */ rcode=0 /* ALLOCATE REQUESTER */ allocarexxrequester '"Define Signature Block"' 338 117 hSigReq=result /* ADD GADGETS */ addarexxgadget hSigReq EXIT 12 100 70 label "Ok" hOkGadget=result addarexxgadget hSigReq EXIT 256 100 70 label "Cancel" hCancelGadget=result sDefault = 'Sincerely,'||d2c(10)||d2c(10)||d2c(10)||d2c(10)||d2c(10)'John Doe' addarexxgadget hSigReq MULTILINE 12 10 314 78 string '"'sDefault'"' hSigGadget=result /* SHOW REQUESTER */ doarexxrequester hSigReq if result=hCancelGadget then rcode=9 else do /* GET GADGET STATUS */ getarexxgadget hSigReq hSigGadget string sSigBlock=result if length(sSigBlock) <2 then rcode=9 end /* FREE REQUESTER */ freearexxrequester hSigReq /* CREATE SIGNATUREBLOCK FILE */ if rcode ~= 9 then do /* Strip the extra linefeed that pagestream added */ sSigBlock = left(sSigBlock,length(sSigBlock)-1) call open(.ofile, sSigFile, 'W') call writeln(.ofile, sSigBlock) call close(.ofile) /* Tell the user how to change the signature block */ call doalert('You can change your signature block later by editing PageStream3:|Scripts/TextClips/SignatureBlock.TXT, or by deleting it and then|running this script again.') end RETURN rcode OPENLIBS: /* OPEN LIBRARIES */ IF ~SHOW('L','rexxsupport.library') THEN call addlib('rexxsupport.library',0,-30) IF ~SHOW('L','softlogik:libs/slarexxsupport.library') THEN call addlib("softlogik:libs/slarexxsupport.library", 0, -30) RETURN DOALERT: /* GENERAL PURPOSE ALERT REQUESTER */ parse arg sAlertText iLineCount = 1 iAlertLength = 1 iLinePos = pos('|',sAlertText) /* BREAK ALERT TEXT INTO MULTIPLE LINES. REMEMBER, PAGESTREAM'S MAX IS 10! */ if iLinePos ~= 0 then do do until iLinePos = 0 sAlertText.iLineCount = left(sAlertText,iLinePos-1) iLineLength = length(sAlertText.iLineCount) if iLineLength > iAlertLength then iAlertLength = iLineLength iLineCount = iLineCount + 1 sAlertText = right(sAlertText,length(sAlertText)-iLinePos) iLinePos = pos('|',sAlertText) end end sAlertText.iLineCount = sAlertText iLineLength = length(sAlertText.iLineCount) if iLineLength > iAlertLength then iAlertLength = iLineLength /* Display an alert requester */ allocarexxrequester '"'sScriptName' Alert"' iAlertLength*8+24 45+iLineCount*10 hAlertReq=result do i = 1 to iLineCount addarexxgadget hAlertReq TEXT 8 2+i*10 iAlertLength*8+8 border none string '"'sAlertText.i'"' end i addarexxgadget hAlertReq EXIT iALertLength*8-58 28+iLineCount*10 70 label "_Exit" doarexxrequester hAlertReq freearexxrequester hAlertReq RETURN ERROR: /* TRAP ERRORS */ call doalert(sError) RETURN 9