Jump to content

how to print '{query}' as the text of a title in ScriptFilter


Recommended Posts

Is it possible to have the text '{query}' as part of a title in Alfred's results?

 

I have a test worflow, that uses the ScriptFilter to output items.

 

Keyword is test and no arguments are required.

 

The XML is being generated via a sh call to a file called XML.sh, which just cats out an XML.

There are two items in the result, each with a title of "this is a test for '{query}'"

The first item has an arg value = 'hello', and second item has arg value = 'world'.

I want to have two items shown in Alfred with the text this is a test for '{query}' but {query} gets replaced with the text of the arg of each item.

 

 

Is there no way to print out '{query}' as text?

 

Also, if I just cat out the XML directly in the ScriptFilter, '{query}' will be replaced by '', because the script filter itself does not need any arguments.

 

Sample workflow

 

test%20query.png

Link to comment

Is it possible to have the text '{query}' as part of a title in Alfred's results?

 

I have a test worflow, that uses the ScriptFilter to output items.

 

Keyword is test and no arguments are required.

 

The XML is being generated via a sh call to a file called XML.sh, which just cats out an XML.

There are two items in the result, each with a title of "this is a test for '{query}'"

The first item has an arg value = 'hello', and second item has arg value = 'world'.

I want to have two items shown in Alfred with the text this is a test for '{query}' but {query} gets replaced with the text of the arg of each item.

 

 

Is there no way to print out '{query}' as text?

 

Also, if I just cat out the XML directly in the ScriptFilter, '{query}' will be replaced by '', because the script filter itself does not need any arguments.

 

Sample workflow

 

test%20query.png

 

Well this is kind of a weird one but it CAN be done. No matter what you put in the code (encoding the {} differently), if Alfred sees {query}, its going to get replaced. The way to force it is to have an additional character in there that can't be seen. Try adding a zero width non-joiner in. What's what? Yeah.. I would have had to ask to :)

 

In your XML, change {query} to {query‌} 

 

That adds an additional character in there so Alfred won't replace it and it also won't be seen :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...