JustCode : Work Out Value of Question On or Off Path

From time to time i find this very useful. This JustCode script will return the value of a question based on if it has an OffPath value or not.

Function WorkOutValue(oIOM,oQuestion,sReturn)
On Error Goto LogIt

if ( oQuestion.Response.value <> oQuestion.Info.OffPathResponse ) Then 

	if ( oQuestion.Info.OffPathResponse <> "" ) then
			
		select case sReturn
			Case = "V"
				WorkOutValue = ctext(oQuestion.Info.OffPathResponse)
			Case = "C"
				WorkOutValue = "{" + ctext(format(oQuestion.Info.OffPathResponse,"a")) + "}"
		End Select
	else
				
		select case sReturn
			Case = "V"
				WorkOutValue = ctext(oQuestion.Response.value)
			Case = "C"
				WorkOutValue = "{" + ctext(format(oQuestion.Response.value,"a")) + "}"
		End Select
		
	end if
Else
	
	select case sReturn
		Case = "V"
			WorkOutValue = ctext(oQuestion.Response.value)
		Case = "C"
			WorkOutValue = "{" + ctext(format(oQuestion.Response.value,"a")) + "}"
	End Select
End If

Goto SkipError

LogIt:
		
	oIOM.Terminate(Signals.sigError)
	
SkipError:

	On Error Goto 0	

		WorkOutValue = WorkOutValue
End Function

JustCode : Send Email via Lotus Notes

Want to send an email to someone using Lotus Notes. This script will help you do that.

' Tested on Notes Version 8.0

Dim Maildb
Dim MailDoc
Dim Body
Dim Session

'Start a session to notes
Set Session = CreateObject("Lotus.NotesSession")

Session.Initialize("PASSWORD_HERE")

Set Maildb = Session.GETDATABASE("", "NSFFILE_LOCATION_HERE")

If Not Maildb.IsOpen = True Then
Maildb.Open()
End If

'Create the mail document
Set MailDoc = Maildb.CREATEDOCUMENT()

MailDoc.ReplaceItemValue("Form", "Memo")
'Set the recipient
MailDoc.ReplaceItemValue("SendTo", "MyEmail@Myserver.com")
'Set subject
MailDoc.ReplaceItemValue("Subject", "Subject Text")

'Create and set the Body content
Set Body = MailDoc.CREATERICHTEXTITEM("Body")
Body.APPENDTEXT("Body text here")

'Example to create an attachment (optional)
Body.ADDNEWLINE(2)
Body.EMBEDOBJECT(1454, "", "MYFILELOCATION_HERE", "Attachment")

'Example to save the message (optional)
MailDoc.SAVEMESSAGEONSEND = True
'Send the document
'Gets the mail to appear in the Sent items folder
MailDoc.ReplaceItemValue("PostedDate", Now())
MailDoc.SEND(False)

'Clean Up
Set Maildb = null
Set MailDoc = null
Set Body = null
Set Session = null

JustCode : Loop File a character at a time

This JustCode script shows us how to open a file in read-only mode and loop through it a character at a time.

 ' ****************************************
' Designed by : Smarter Dimensions
' Last Updated : 24th July 2009
' Loop File a character at a time.
' ****************************************

Dim oFSO, oFile

Set oFSO = CreateObject("Scripting.FileSystemObject")

Set oFile = oFSO.OpenTextFile("C:\temp\test.txt",1,false,0)

Do While oFile.AtEndOfStream = false
debug.Log(oFile.Read(1))
Loop


oFile.Close()
%d bloggers like this: