Home > LiftTool > Automation

Controlling LiftToolTM from Different Software Environments

Class LiftToolCmd is declared in LiftTool.exe as GlobalMultiUse. It has one method, Exec, which is set as default. The method accepts a string with command (or sequence of commands, separated by ";") and returns the string with result (or sequence of results, separated by ";"). In general, the syntax (in Visual Basic) to execute a command is:

<result_string> = LiftToolCmd(<command_string>)

Communication through DDE is based on sending information between the components of forms of the server and client applications. It is more cumbersome in use than ActiveX and may be slower.

Download TestLT.zip - a Visual Basic project illustrating how LiftTool can be controlled from other applications through ActiveX and DDE.

Visual Basic through ActiveX

Dim command as String, result as String
'FORM OR INPUT COMMAND STRING
'EXECUTE COMMAND
result = LiftToolCmd(command)
'ANALYZE RESULT STRING

There is no need to declare the class and to create an instance of this class, since it is GlobalMultiUse. There is no need to define method, since it is default.

Visual Basic through DDE

In order to communicate with a client through DDE LiftTool must be visible. Assume that the form of the client application contains two text boxes: Text1, which contains the command, and Text2, which contains the response.

On Error GoTo LOADSERV
EXECMD:
   'SEND COMMAND
   Text1.LinkMode = vbLinkNone
   Text1.LinkTopic = "LiftTool|Command"
   Text1.LinkMode = vbLinkManual
   Text1.LinkExecute Text1.Text 'EXECUTE COMMAND IN TEXT BOX Text1
   Text1.LinkMode = vbLinkNone
   'GET RESPONSE (FROM THE LABEL BOX lblMsg OF LiftTool)
   Text2.LinkMode = vbLinkNone
   Text2.LinkTopic = "LiftTool|Command"
   Text2.LinkItem = "lblMsg" 
   Text2.LinkMode = vbLinkManual
   Text2.LinkRequest
   Text2.LinkMode = vbLinkNone
...
LOADSERV:
   'LOAD LiftTool EXECUTABLE FROM THE DIRECTORY, WHERE IT RESIDES
   Shell ("<path>\LiftTool.exe Show")
   On Error GoTo 0
   GoTo EXECMD

ImagePro Basic and Aphelion Basic through ActiveX

Internal macro languages of ImagePro and Aphelion are flavors of MS Visual Basic. Important for us is that LiftTool must be declared, and an instance of it must be created. Following is the text that works for both packages.

Dim command As string, result As string
Dim LTool As Object
Set LTool = CreateObject("LiftTool.LiftToolCmd")
...
'FORM OR INPUT COMMAND STRING command
'EXECUTE COMMAND
result = LTool(command)
'ANALYZE RESULT STRING result
..
Set LTool = Nothing

ImagePro Basic through DDE

Global LTResponse as String * 100

Function LiftTool_IP(cmd as String) as Integer
   ret = IpDde(DDE_OPEN,"LiftTool", "Command")
   ret = IpDde(DDE_EXEC,cmd,"")
   LiftTool_IP = IpDde(DDE_GET, "lblMsg", LTResponse)
   ret = IpDde(DDE_CLOSE, "", "")
End Function

Sub Test()
   Dim lcmd as String*100
CMD:
   ret = IpStGetString(LTResponse, scmd, 100)
   if (ret<>1) then GoTo FIN
   ret = LiftTool_IP(scmd)
   GoTo CMD
FIN:
End Sub

MATLAB

LTool = actxserver('LiftTool.LiftToolCmd');
...
%FORM OR INPUT COMMAND STRING command
%EXECUTE COMMAND
result = invoke(LTool, 'Exec', command);  % E.g. res = invoke(LTool, 'Exec', 'F 7');
%ANALYZE RESULT STRING result
...
delete(LTool);

Home > LiftTool > Automation