This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RocketBZ_API_Ex_UDF.au3
243 lines (193 loc) · 13.2 KB
/
RocketBZ_API_Ex_UDF.au3
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#cs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Name..................: RocketBZ_Extended_API_UDF
Description...........: Extended UDF for Rocket BlueZone terminal emulator API
Dependencies..........: Rocket Bluezone 7.1 x32/x64;
<RocketBZ_Globals.au3>;
<RocketBZ_API_Core_UDF.au3>
Documentation.........: https://www3.rocketsoftware.com/bluezone/help/v71/en/bzsh/bzaa/source/bzaa_acon_bz-host-automation-object.htm
https://www3.rocketsoftware.com/bluezone/help/v71/en/bzsh/bzaa/source/bzaa_aref_bz-object-methods.htm
Author................: exorcistas@github.com
Modified..............: 2020-12-04
Version...............: v1.8.2b
#ce ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include-once
#include <RocketBZ_Globals.au3>
#include <RocketBZ_API_Core_UDF.au3>
#Region FUNCTIONS_LIST
#cs ===================================================================================================================================
%% HOST_EXTENDED %%
_RocketBZ_Ext_AttachActiveMainframeSession()
_RocketBZ_Ext_AttachActiveVTSession()
%% EXTENDED_CORE %%
_RocketBZ_Ext_GetText($_oRocketBZHost, $_iRowVal, $_iColumnVal, $_iLengthVal)
_RocketBZ_Ext_SendKeysAndWait($_oRocketBZHost, $_sKeys, $_iRepeatTimes = 1)
_RocketBZ_Ext_SendEnter($_oRocketBZHost, $_iRepeatTimes = 1)
_RocketBZ_Ext_EraseField($_oRocketBZHost, $_iRow, $_iCol)
_RocketBZ_Ext_EraseFieldAndPutString($_oRocketBZHost, $_sString, $_iRow, $_iCol, $_bEraseField = True)
_RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost, $_sExpectedTextOnScreen = "", $_iTimeoutValue = 0)
_RocketBZ_Ext_UnlockMainframeKeyboard($_oRocketBZHost)
#ce ===================================================================================================================================
#EndRegion FUNCTIONS_LIST
#Region HOST_EXTENDED
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_AttachActiveMainframeSession()
Description ...: Creates RocketBZ COM object and attaches to active Mainframe session
Syntax.........: -
Parameters.....: -
Return values..: {$_oRocketBZHost} connected host object; sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-07-01
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_AttachActiveMainframeSession()
Local $_oRocketBZHost = __RocketBZ_CreateObject($__RocketBZ_MAINFRAME_DISPLAY)
If @error Then Return SetError(@error, @extended)
Local $_iReturnCode = __RocketBZ_Connect($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
_RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
Return $_oRocketBZHost
EndFunc ;==>_RocketBZ_Ext_AttachActiveMainframeSession
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_AttachActiveVTSession()
Description ...: Creates RocketBZ COM object and attaches to active VT session
Syntax.........: -
Parameters.....: -
Return values..: {$_oRocketBZHost} connected host object; sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-12-04
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_AttachActiveVTSession()
Local $_oRocketBZHost = __RocketBZ_CreateObject($__ROCKETBZ_VT_DISPLAY)
If @error Then Return SetError(@error, @extended)
Local $_iReturnCode = __RocketBZ_Connect($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
_RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
Return $_oRocketBZHost
EndFunc ;==>_RocketBZ_Ext_AttachActiveVTSession
#EndRegion HOST_EXTENDED
#Region EXTENDED_CORE
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_GetText($_oRocketBZHost, $_iRowVal, $_iColumnVal, $_iLengthVal)
Description ...: Reads contents from screen
Syntax.........: -
Parameters.....: {$_oRocketBZHost} connected host object
{$_iRowVal, $_iColumnVal} row and column as start position to read (min value = 1)
{$_iLengthVal} lenght of string to read (min value = 1)
Return values..: {$_sText} string from screen; sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-11-11
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_GetText($_oRocketBZHost, $_iRowVal, $_iColumnVal, $_iLengthVal)
Local $_sText = __RocketBZ_PSGetText($_oRocketBZHost, $_iRowVal, $_iColumnVal, $_iLengthVal)
If @error Then Return SetError(@error, @extended)
Return $_sText
EndFunc ;==>_RocketBZ_Ext_GetText
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_SendKeysAndWait($_oRocketBZHost, $_sKeys, $_iRepeatTimes = 1)
Description ...: Sends keyboard signals to emulator
Syntax.........: see function: __RocketBZ_SendKey
Parameters.....: {$_oRocketBZHost} connected host object
{$_sKeys} keyboard value to send
{$_iRepeatTimes} times to repeat key signal
Return values..: sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-07-01
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_SendKeysAndWait($_oRocketBZHost, $_sKeys, $_iRepeatTimes = 1)
For $i = 1 To $_iRepeatTimes
_RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
__RocketBZ_SendKey($_oRocketBZHost, $_sKeys)
If @error Then Return SetError(@error, @extended)
Next
_RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
EndFunc ;==>_RocketBZ_Ext_SendKeysAndWait
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_SendEnter($_oRocketBZHost, $_iRepeatTimes = 1)
Description ...: Sends Enter key signal to emulator
Syntax.........: see function: _RocketBZ_Ext_SendKeysAndWait
Parameters.....: {$_oRocketBZHost} connected host object
{$_iRepeatTimes} times to repeat key signal
Return values..: sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-07-01
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_SendEnter($_oRocketBZHost, $_iRepeatTimes = 1)
_RocketBZ_Ext_SendKeysAndWait($_oRocketBZHost, "<Enter>", $_iRepeatTimes)
Return SetError(@error, @extended)
EndFunc ;==>_RocketBZ_Ext_SendEnter
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_EraseField($_oRocketBZHost, $_iRow, $_iCol)
Description ...: Erases field contents from given position
Syntax.........: see function: _RocketBZ_Ext_SendKeysAndWait
Parameters.....: {$_oRocketBZHost} connected host object
{$_iRow, $_iCol} row, column start position of field to erase
Return values..: sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-07-01
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_EraseField($_oRocketBZHost, $_iRow, $_iCol)
_RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost)
If @error Then Return SetError(@error, @extended)
__RocketBZ_SetCursor($_oRocketBZHost, $_iRow, $_iCol)
If @error Then Return SetError(@error, @extended)
_RocketBZ_Ext_SendKeysAndWait($_oRocketBZHost, "<EraseEOF>")
If @error Then Return SetError(@error, @extended)
EndFunc ;==>_RocketBZ_Ext_EraseField
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_EraseFieldAndPutString($_oRocketBZHost, $_sString, $_iRow, $_iCol, $_bEraseField = True)
Description ...: Clears field from given position and sets text in same position
Syntax.........: see functions: _RocketBZ_Ext_EraseField; _RocketBZ_Ext_SendKeysAndWait
Parameters.....: {$_oRocketBZHost} connected host object
{$_sString} text to set
{$_iRow, $_iCol} row, column start position of field to erase and set text
{$_bEraseField} An optional parameter to disable field erasing
Return values..: sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-11-16
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_EraseFieldAndPutString($_oRocketBZHost, $_sString, $_iRow, $_iCol, $_bEraseField = True)
If $_bEraseField = True Then
_RocketBZ_Ext_EraseField($_oRocketBZHost, $_iRow, $_iCol)
If @error Then Return SetError(@error, @extended)
EndIf
__RocketBZ_WriteScreen($_oRocketBZHost, $_sString, $_iRow, $_iCol)
If @error Then Return SetError(@error, @extended)
EndFunc ;==>_RocketBZ_Ext_EraseFieldAndPutString
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost, $_sExpectedTextOnScreen = "", $_iTimeoutValue = 0)
Description ...: Waits for screen/application readiness, may look for specific text appear
Syntax.........: see functions: __RocketBZ_WaitReady; _RocketBZ_Ext_WaitScreenRefresh; __RocketBZ_WaitForText
Parameters.....:
{$_oRocketBZHost} connected host object
{$_sExpectedTextOnScreen} text to wait appear on screen
{$_iTimeoutValue} time to wait for specific text
Return values..: sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-11-10
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_WaitScreenRefresh($_oRocketBZHost, $_sExpectedTextOnScreen = "", $_iTimeoutValue = 0)
If $_sExpectedTextOnScreen <> "" Then
__RocketBZ_WaitForText($_oRocketBZHost, $_sExpectedTextOnScreen, 1, 1, $_iTimeoutValue)
Else
__RocketBZ_WaitReady($_oRocketBZHost)
EndIf
Return SetError(@error, @extended)
EndFunc ;==>_RocketBZ_Ext_WaitScreenRefresh
#cs #FUNCTION# ====================================================================================================================
Name...........: _RocketBZ_Ext_UnlockMainframeKeyboard($_oRocketBZHost)
Description ...: Sends <Reset> (Left Control) key to unlock Mainframe
Syntax.........: see: __RocketBZ_Status; _RocketBZ_Ext_SendKey
Parameters.....: {$_oRocketBZHost} connected host object
Return values..: sets @error+@extended on exception
Author ........: exorcistas@github.com
Modified.......: 2020-10-12
#ce #FUNCTION# ====================================================================================================================
Func _RocketBZ_Ext_UnlockMainframeKeyboard($_oRocketBZHost)
Local $_iStatus = __RocketBZ_Status($_oRocketBZHost)
If $_iStatus = 5 Then __RocketBZ_SendKey($_oRocketBZHost, "<Reset>")
Return SetError(@error, @extended)
EndFunc ;==>_RocketBZ_Ext_UnlockMainframeKeyboard
#EndRegion EXTENDED_CORE