IFTTT へイベントを送信する(ボタン)

Option Public
Uselsx "*javacon"
Use "Ifttt"
%INCLUDE "lsconst.lss"

Sub Click(Source As Button)
	Dim mySession As JavaSession
	Dim myClass As JavaClass
	Dim myObject As JavaObject
	Dim ws As New NotesUIWorkspace
	Dim uidoc As NotesUIDocument
	Dim doc As NotesDocument
	Dim result As Boolean
	Dim eventName As String
	Dim keyValue As String
	Dim value1 As String
	Dim value2 As String
	Dim value3 As String
	Dim ans As Integer
	Set uidoc = ws.CurrentDocument
	Set doc = uidoc.Document
	ans = Messagebox("Send this event to IFTTT." , MB_OKCANCEL + MB_ICONINFORMATION + MB_DEFBUTTON2, "IFTTT")
	If (ans = IDOK) Then
		eventName = doc.eventName(0)
		keyValue = doc.keyValue(0)
		value1 = doc.value1(0)
		value2 = doc.value2(0)
		value3 = doc.value3(0)
		Set mySession = New JavaSession()
		Set myClass = mySession.GetClass("chemp.Ifttt.Ifttt")
		Set myObject = myClass.CreateObject
		result = myObject.callEvent(eventName , keyValue, value1, value2, value3)
		If ( result  ) Then
			Messagebox "Sending is complited!", MB_OK + MB_ICONINFORMATION, "IFTTT"
			Messagebox "Failure!", MB_OK + MB_ICONSTOP, "IFTTT"
		End If	
		Exit Sub
	End If
End Sub

IFTTT へイベントを送信するボタンのサンプルです。
LS2J を使って、LotusScript から Java クラスを呼び出しています。
Java クラスは、スクリプトライブラリ「Ifttt」として登録します。

Java クラスは、以下を参照ください。

IFTTT へイベントを送信する(1)

IFTTT へイベントを送信する(2)

July 1, 2017 at 1:55 PM

No comments yetLogin first to comment...