Class ScopeToolCmd is declared in ScopeTool.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> = ScopeToolCmd(<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
TestST.zip - a Visual Basic project illustrating how
ScopeTool can be controlled from other applications through ActiveX and DDE.
Dim command as String, result as String
'FORM OR INPUT COMMAND STRING
'EXECUTE COMMAND
result = ScopeToolCmd(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.
In order to communicate with a client through DDE ScopeTool 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 = "ScopeTool|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
ScopeTool)
Text2.LinkMode = vbLinkNone
Text2.LinkTopic = "ScopeTool|Command"
Text2.LinkItem = "lblMsg"
Text2.LinkMode = vbLinkManual
Text2.LinkRequest
Text2.LinkMode = vbLinkNone
...
LOADSERV:
'LOAD ScopeTool EXECUTABLE FROM THE
DIRECTORY, WHERE IT RESIDES
Shell ("<path>\ScopeTool.exe Show")
On Error GoTo 0
GoTo EXECMD
Internal macro languages of ImagePro and Aphelion are flavors of MS Visual Basic. Important for us is that ScopeTool 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 ScTool As Object
Set ScTool = CreateObject("ScopeTool.ScopeToolCmd")
...
'FORM OR INPUT COMMAND STRING command
'EXECUTE COMMAND
result = ScTool(command)
'ANALYZE RESULT STRING result
..
Set ScTool = Nothing
Global STResponse as String
* 100
Function ScopeTool_IP(cmd as String) as Integer
ret = IpDde(DDE_OPEN,"ScopeTool", "Command")
ret = IpDde(DDE_EXEC,cmd,"")
ScopeTool_IP = IpDde(DDE_GET, "lblMsg", STResponse)
ret = IpDde(DDE_CLOSE, "", "")
End Function
Sub Test()
Dim scmd as String*100
CMD:
ret = IpStGetString(STResponse, scmd, 100)
if (ret<>1) then GoTo FIN
ret = ScopeTool_IP(scmd)
GoTo CMD
FIN:
End Sub
ScTool = actxserver('ScopeTool.ScopeToolCmd');
...
%FORM OR INPUT COMMAND STRING command
%EXECUTE COMMAND
result = invoke(ScTool, 'Exec', command); %E.g. res = invoke(ScTool, 'Exec', 'F 7');
%ANALYZE RESULT STRING result
...
delete(ScTool);
Home > ScopeTool software
> Automation