SUBROUTINE Q.ATPROPERTY(action, name, value) ********************************************************************** * Author : BSS * Created: 14 Jan 2014 * Updated: 01 May 2014 * Version: 1.0.2 * Desc : Get or Set an Accuterm property * * Copyright 2014 Rush Flat Software * See licence conditions in: BP.Q licence.txt * * History: * Jan 2022 - Update name of subroutine to run script. * May 2014 - Check for data type on assignment. If string, the quote * the value being assigned. * * ------------------------------------------------------------------- * * $INCLUDE Q.INCLUDES QB.COMMON.H action = UPCASE(action) doset = INDEX(action, 'S', 1) IF (doset) THEN GOSUB setproperty END ELSE GOSUB getproperty END RETURN * * ------------------------------------------------------------------- * * getproperty: * * This routine had a problem where it would return a value from a "late" * keystroke before the value requested. INPUTCLEAR wouldn't remove this * value, nor would INPUTIF recognise it. Maybe it entered the buffer after * the call to run the script. * * The roundabout solution is to delimit the requested output with the pipe * character, and return only the data that follows the initial pipe. * value = '' IF (name EQ '') THEN RETURN script = 'InitSession.Output "|" & CStr(InitSession.':name:') & vbCR' CALL Q.RUNSCRIPT(script, err) IF (err) THEN RETURN ECHO OFF INPUT value value = FIELD(value, '|', 2, 999) ECHO ON RETURN * * ------------------------------------------------------------------- * * setproperty: * IF (name EQ '') THEN RETURN CALL Q.DATATYPE(value, datatype) script = 'InitSession.':name:' = ' IF (datatype EQ 'A') THEN ;* A = Alpha IF (value[1, 1] NE '"') THEN script := DQUOTE(value) END END ELSE script := value END CALL Q.RUNSCRIPT(script, err) RETURN * * ------------------------------------------------------------------- * * END