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"
		Else
			Messagebox "Failure!", MB_OK + MB_ICONSTOP, "IFTTT"
		End If	
	Else
		Exit Sub
	End If
End Sub





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

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

IFTTT へイベントを送信する(1)
https://xpages.jp/XSnippetsJ.nsf/snippet.xsp?id=ifttt-%E3%81%B8%E3%82%A4%E3%83%98%E3%82%99%E3%83%B3%E3%83%88%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B1

IFTTT へイベントを送信する(2)
https://xpages.jp/XSnippetsJ.nsf/snippet.xsp?id=ifttt-%E3%81%B8%E3%82%A4%E3%83%98%E3%82%99%E3%83%B3%E3%83%88%E3%82%92%E9%80%81%E4%BF%A1%E3%81%99%E3%82%8B2

LotusScript
tyoshida
July 1, 2017 at 1:55 PM
Rating
0





No comments yetLogin first to comment...