如果您不能代理RunOnServer
那麼您可以使用LS2J
代替代理。使用線程創建自己的類並使用其屬性。
這裏是例如自定義Java Class
和Java Timer
:
import java.util.Timer;
import java.util.TimerTask;
public class Test
{
private boolean _isOver;
private int _counter;
private Timer _timer;
private String _url;
public Test()
{
_timer = new Timer("Timer");
}
public void Start() //Add parameters here that you want to use in Java
{
_counter = 0;
_isOver = false;
_url = "";
TimerTask timerTask = new TimerTask()
{
public void run()
{
if (_counter++ == 9)
{
_isOver = true;
_timer.cancel();
_url = "http://stackoverflow.com/";
}
}
};
_timer.scheduleAtFixedRate(timerTask, 30, 5000);
}
public int getCounter() { return _counter; }
public boolean getIsOver() { return _isOver; }
public String getURL() { return _url; }
}
在LotusScript
添加全局LS2J
變量:
(Options)
Uselsx "*javacon"
Use "MyJavaLibrary"
(Declarations)
Dim jSession As JavaSession
Dim jClass As JavaClass
Dim jObject As JavaObject
Sub Initialize
Set jSession = New JavaSession()
Set jClass = jSession.GetClass("MyClass")
Set jObject = jClass.CreateObject
End Sub
要啓動Java object
使用(在Button
LotusScript
):
Call jObject.Start() 'Call with parameters that you want to use in Java
要檢查狀態,並取得進展的使用(以Timer
LotusScript
):
If jObject.getIsOver() Then
s$ = jObject.getURL()
'Show results
Else
i% = jObject.getCounter()
'Show progress
End If
我將不勝感激任何解釋向下的一票! – AHH