Jump to content

Search the Community

Showing results for tags 'script-filter'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting

Categories

  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Website URL


Jabber


Location


Interests

Found 3 results

  1. Script Filter Details: 1. Keyword: @fp (@fp:find product) with space Argument Optional 2. Checked "Alfred filters results" 3. Script: cat <filename>.json When typed query does not match filter results, Alfred shows fall back results. I want to perform action, when the typed query does not match filter results. How to do it? I am assuming, I have to remove "Alfred filters results" check box. Then, check if query argument exists in the json file. If not, I can perform action via applescript but if it does exist, then how to do what Alfred does when it filters results?
  2. Hello everyone, I'm creating a small snippet that retrieves data for a given domain and prints out a few options based on the domain availability. Currently I got it working with no issues using a keyword and script filter prints out XML items based on the availability. No issue so far. But it's feels pretty unnatural to use the keyword (I'm using 'whose' which is the name of the workflow), so I'd like to make trigger the domain when the query matches a domain structure. Currently there's already a script with opens the URL (it's called openurlsearch), and I'd like to have my workflow appear like that too. Is it possible? I know that I could try to use the fallback solution, but if you type a domain Alfred will only show the Open URL workflow, so people would have to disable the web search from settings and things would be just too complicated. Any ideas to help me solve this out? Thanks!
  3. As of Alfred 2.0.3, it seems that passing multi-line text out from a script filter via the arg attribute (e.g., to the copy-to-clipboard action) is not supported: each newline is replaced with a space. I suspect this is a side effect of XML parsing, since the desired output value is stored in an XML attribute, and even though newlines are legal in attribute values, on passing the value out, XML parsers are expected to normalize the value by replacing all non-space whitespace characters with a space each, including \n (and \r\n) - see http://www.w3.org/TR/1998/REC-xml-19980210#AVNormalize Would be nice not to have this restriction, though, assuming my guess is correct, I'm not sure it's feasible with the current, XML-document-based approach. A workaround is below, but it is somewhat cumbersome. Workaround [updated on 2 May 2013 to incorporate David Ferguson's suggestion]: Inside the script filter, create a custom encoding where you replace newline chars. with a placeholder, e.g.: ⏎ Use the custom-encoded text as the value of the arg attribute. Add an intermediate script action that decodes the custom encoding by substituting newlines for the placeholders to restore the original value and then passes the restored value out.Sadly, since output from script actions cannot follow conditional paths based on keyboard modifiers, you'll have to duplicate the intermediate script action for every modifier combination you want to support, and attach the modifier-specific paths directly to the script filter. Download a demonstration workflow here: https://dl.dropboxusercontent.com/u/10047483/MultilineTextScriptFilterLimitationDemo.alfredworkflow Keyword "mt1" demonstrates the original limitation by attempting to copy a 2-line string passed from a script filter to the clipboard. Keyword "mt2" demonstrates the workaround. Workaround source code: Sample script-filter action (using /bin/bash: escape only backquotes, double quotes, backslashes, dollars): # Create sample multiline text. text=$'line 1\nline 2' # Derive a single-line representation for Alfred's result list. textForDisplay="${text//$'\n'/ ⏎ }" # Since linefeeds are inadvertently replaced by spaces when the value assigned to the `arg` attribute # is retrieved later, we assign a custom-encoded form of the output text in which we replace newlines # with placeholders. # In a subsequent, auxiliary script-action step we then perform unencoding to restore the original text. textEncoded=${text//$'\n'/⏎} cat <<EOF <?xml version="1.0"?> <items> <item arg="$textEncoded"> <title>$textForDisplay</title> <subtitle>Action to copy to clipboard and display notif.</subtitle> </item> </items> EOF Generic, directly reusable script action that unencodes (decodes) the custom encoding and relays the restored value (using /bin/bash; escape only backquotes, double quotes, backslashes, dollars): # Input is assumed to be custom-encoded text in which newlines have # been replaced with ⏎ chars. # We UNencode (decode) here in order to restore the newlines, and pass the # restored text out. v="{query}" echo -nE "${v//⏎/$'\n'}"
×
×
  • Create New...