alias ui1_inputTest {
;; DATA TO PASS INTO THE THE COM AS A UI1 ARRAY
bset -t &ui1_data 1 this is some data to send as ui1_array
comopen ui1_test ADODB.Stream
if (!$com(ui1_test) || $comerr) {
echo -a failed to create stream instance
}
elseif (!$com(ui1_test, open, 1) || $comerr) {
echo -a Failed to open stream
}
elseif (!$com(ui1_test, type, 4, integer, 1) || $comerr) {
echo -a Failed to set the read/write type to binary
}
;; THIS LINE PASSES A UI1 ARRAY INTO THE COM
elseif (!$com(ui1_test, write, 1, array &ui1, &ui1_data) || $comerr) {
echo -a Failed to write data to stream
}
elseif (!$com(ui1_test, position, 4, integer, 0) || $comerr) {
echo -a Failed to reset position
}
elseif (!$com(ui1_test, saveToFile, 1, bstr, $mircdirui1_text.dat, integer, 2) || $comerr) {
echo -a Failed to save to file
}
elseif (!$com(ui1_test, close, 1) || $comerr) {
echo -a Failed to close stream
}
else {
echo -a All done; check $mircdirui1_text.dat to see what was wrote
}
if ($com(ui1_test)) .comclose ui1_test
}