summaryrefslogtreecommitdiff
path: root/comIvy/ivyscript.vbs
blob: f8efd5a10c6d5142313fd68ead18510f82f84242 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
'--------------------------------------------
' IVYscript.vbs
'--------------------------------------------
Option Explicit
'On Error Resume Next

dim bus,all_message,pp,count


set bus = WScript.CreateObject("comIvy.Bus", "bus_")

WScript.Echo " bus type " & TypeName(bus)

bus.Create "IvyScript", "IvyScript Ready"
WScript.Echo " bus domain " & bus.GetDomain()

set all_message= bus.Bind( "(.*)")


WScript.ConnectObject all_message, "all_"

set pp= bus.Bind( "^PPilot(.*)") 

'WScript.Echo " all type " & TypeName(all)


WScript.ConnectObject pp, "pp_"

bus.Start ""

WScript.Sleep 2000
count= bus.Send( "ClockStart" )
WScript.Echo "Sent " & count 
WScript.Sleep 25000

WScript.Echo " Unbind Message " & TypeName(all_message)

all_message.Unbind()

WScript.Echo " Unbind Message " & TypeName(all_message)
pp.Unbind()

WScript.Echo " End Ivy Script Test " & TypeName(bus)

'bus.Delete()
'--------------------------------------------
sub bus_ApplicationConnected(name)
    WScript.Echo "Application Connected " & name
end sub
'--------------------------------------------
'--------------------------------------------
sub bus_ApplicationDisconnected(name)
    WScript.Echo "Application Disconnect " & name
end sub
'--------------------------------------------
'--------------------------------------------
sub all_Received(name,args)
	dim i,argc,argv
	WScript.Echo " args type " & TypeName(args)

    argc = UBound(args) - LBound(args) + 1
	argv = " args: "
	for i = LBound(args) to UBound(args) 
	argv = argv & args(i) & ","
	next
	WScript.Echo "Receive message argc=" & Cstr(argc ) & argv
end sub
'--------------------------------------------
'--------------------------------------------
sub pp_Received(name,args)
    dim i,argc,argv
    argc = UBound(args) - LBound(args) + 1
	argv = " args: "
	for i = LBound(args) to UBound(args) 
	argv = argv & args(i) & ","
	next
	WScript.Echo "Receive PPilot message argc=" & Cstr(argc ) & argv
end sub
'--------------------------------------------
sub Received(args)
    WScript.Echo "Unknown Receive message argc=" & Cstr(args)& "->" & args(0)
end sub