Note on Macro System 2.0 command GetText$
=========================================
(Date: 8/31/94)


If you use GetText$ command in your macros, you may have experienced getting various error messages associated with GetText$ and bring services in general. Sometimes the error message may be useful, other times it's not. For example, if there is no data selected in the current bring server application, you may get a "GetText$: Bring server has no data available". In this case, an empty string returned by GetText$ might be a "cleaner" way.

You can use the TestSrv% procedure provided below to test the exact status of the bring server before you ever call GetText$. Using it around GetText$ will prevent getting unwanted error messages:

	PROC macro:
	UseApp:("active")
	if testsrv%:=0
		GiPrint:( GetText$: )
	endif
	ENDP

Note that sometimes you may still get a "blink" error (as opposed to a full-screen error message). Unfortunately, checking for this condition is impossible without starting the actual data transfer from the bring server.


---------------------------------8<-------------------------------
rem -- Return value:
rem -- (zero) - Bring Server is ready to serve data
rem -- (negative) - error

PROC testsrv%:
local wsrv$(15), in%(6), fmt&, pid%, pfmt%

wsrv$ = "SYS$WSRV.*" + chr$(0)
in%(1) = $100
in%(2) = uadd( addr( wsrv$ ), 1 )
if os( $88, addr( in%(1) ) ) and 1
	return ( in%(1) and $ff ) - $100
else
	pid% = in%(1)
endif

pfmt% = addr( fmt& )
if call( $683, pid%, 4, 0, addr( pfmt% ),0 ) <= 0
	return -33 rem Bring server not found
endif

if ( fmt& and $16 ) = 0
	return -36 rem Bring server has no data available
endif
ENDP
---------------------------------8<-------------------------------

	T O M