*== GETEDSRC *-- This method returns a character string *-- containing the contents of an open editing window LPARAMETERS tcWindowName LOCAL lcRetVal, ; lcFilNm, ; lcOldLib, ; lnWHandle, ; lnResult, ; lnStopPos, ; laEnvironment *-- Define local variables lcRetVal = "" lcFilNm = IIF( PCOUNT() > 0 AND TYPE( "tcWindowName" ) = "C", ; ALLTRIM( tcWindowName ), ; "" ; ) lcOldLib = set( "library" ) lnWHandle = 0 lnResult = 0 lnStopPos = 0 DECLARE laEnvironment[ 25 ] *-- If we don't have the FOXTOOLS library, *-- load it now IF !( "FOXTOOLS" $ lcOldLib ) SET LIBRARY TO ( HOME() + "FOXTOOLS.FLL" ) ADDITIVE ENDIF && !( "FOXTOOLS" $ lcOldLib ) *-- If a window name was passed, *-- get the 'whandle' of the window IF !EMPTY( lcFilNm ) *-- Get the 'whandle' of the window lnWHandle = _WFindTitl( lcFilNm ) *-- Populate the array with the editor environment lnResult = _EdGetEnv( lnWHandle, @laEnvironment ) *-- Get the size of the contents of the window lnStopPos = IIF( lnResult = 1, ; laEnvironment[ 2 ], ; 1 ; ) *-- Place the code from the window *-- into our working variable lcRetVal = IIF( lnStopPos # 1, ; _EdGetStr( lnWHandle, ; 0, ; lnStopPos ; ), ; "" ; ) *-- Strip all the line feeds ( CHR( 10 ) ) lcRetVal = STRTRAN( lcRetVal, ; CHR( 10 ), ; "" ; ) ENDIF && !EMPTY( lcFilNm ) *-- Restore the LIBRARY string *-- to its previous contents SET LIBRARY TO &lcOldLib. *-- Clean up and return RETURN ( lcRetVal )As far as the ignoring of KEYBOARD commands...I'm not sure, since I don't use them often. I find they don't always work the way I expect/want/need, so I usually end up finding another way around the same situation.