Text View JSON Format
Alfred's Text View can be dynamically populated from a script which outputs the expected format.
Example JSON Format:
{
"variables": {
"fruit": "banana",
"vegetable": "carrot"
},
"rerun": 0.5,
"response": "Fruits are the seed-bearing structures in flowering plants.",
"footer": "Anatomy of fruits and vegetables",
"behaviour": {
"response": "append",
"scroll": "end",
"inputfield": "select"
}
}
Properties
Alfred uses the following properties to define the view's behaviour:
response : STRING
The text to show in the view.
"response": "Fruits are the seed-bearing structures in flowering plants."
footer : STRING (optional)
Text to show in the window's footer.
"footer": "Anatomy of fruits and vegetables"
actionoutput : true | false (optional, default = false)
When set to true
, the Text View closes and the value of response
is automatically sent to the next object.
behaviour : OBJECT (optional)
Set how the text view updates after each script rerun. Example:
"behaviour": {
"response": "append",
"scroll": "end",
"inputfield": "select"
}
response : replace | append | prepend | replacelast (optional, default = replace)
Defines how to update the text content.
replace
modifies the full contents of the Text View with the new response.append
adds the response to the bottom of the view.prepend
adds the response to the top of the view.replacelast
modifies the contents of the last response.
scroll : auto | start | end (optional, default = auto)
Controls the scrolling behaviour of populating text.
auto
scrolls to the start of the new response.start
scrolls to the start of the Text View.end
scrolls to the end of the Text View.
inputfield : clear | select (optional, default = clear)
Defines the behaviour of the input field after actioning with ↩.
clear
erases the text of the input field.select
highlights the text of the input field.
Variables / Session Variables
Variables within a variables
object behave the same as their Script Filter counterpart.
Rerunning Text View scripts automatically
Rerunning a Text View script works the same as its Script Filter counterpart.