PSJ. - JSON Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > JSON - Parser > Parser-Operations > !Library State and Settings >

PSJ. - JSON Operations

PSJ.SetClipOutput

PreviousTopNext


SPR Script Language

 

PSJ.SetClipOutput

Enables or disables the automatic copying of WSTRING results to the clipboard.

 

Intention

 

The PSJ.SetClipOutput command allows you to control whether certain PSJ commands that produce a primary WSTRING result (like PSJ.ToString, PSJ.GetKeys, or extraction commands) will automatically copy that WSTRING result to the system clipboard. You set the desired state using a numeric value (1 for enable, 0 for disable).

 

 

Illustration

📝 Enable clipboard copy:
PSJ.SetClipOutput|1
(Subsequent commands like PSJ.ToString will copy their WSTRING result to the clipboard)
📝 Disable clipboard copy:
PSJ.SetClipOutput|0
(Subsequent commands will not automatically copy to the clipboard)

 

Syntax

 

PSJ.SetClipOutput|$$STA

 

Parameter Explanation

 

P1 - $$STATE - (Variable, Numeric)

The desired state for clipboard output. Required.
- 1: Enable automatic clipboard output.
- 0: Disable automatic clipboard output.
(Any non-zero value will be treated as 1).

 

Technical Background

 

This command calls the W_JSON_SetClipOutput(State) function in the JSW library. This function sets the value of the internal global flag g_JSON_ClipOutput (as a BYTE) to either 1 or 0. This flag is checked by the internal W_JSON_HandleResultOutput function, which is called by commands that produce a primary WSTRING result (like ToString, NodeToStr, GetKeys, many Extract* commands).

 

Examples

 

'***********************************

' Sample 1: Enable and disable clipboard output

PSJ.SetClipOutput|1 ' Enable

PSJ.Parse|'{"msg":"Copied"}'|$$DOC

PSJ.ToString|$$DOC ' WSTR "{"msg":"Copied"}" is copied to clipboard

PSJ.SetClipOutput|0 ' Disable

PSJ.ToString|$$DOC ' WSTR result is set in GetLastResultW, but NOT copied

PSJ.Free|$$DOC

MBX.Ready

'***********************************

 

Remarks

 

- Use 1 to enable clipboard output, 0 to disable.

- This setting persists within the current SSPR session until changed again or until the library is reset/reloaded.

- This is useful for easily grabbing JSON output for debugging or pasting elsewhere.

 

Limitations

 

- Only affects commands that produce a primary WSTRING result and utilize the internal W_JSON_HandleResultOutput helper.

 

See also:

 

PSJ.GetClipOutput

PSJ.GetLastResultW