User Tools

Site Tools


action:Filter

Table of Contents

**This is an old revision of the document!**

The Filter action is extremely powerful for editing the contents of a variable, clipboard or file.

Select the source for the filter, which can be the System Clipboard, a Named Clipboard, the Trigger Clipboard (v8+), a variable, some tokenised text (v8+), or a file (v8+).

Prior to v8.0 there were separate Variable and Clipboard Filter actions.

Select the filter to use from the with pop-up.

The filters are:

  • Remove Styles (ie, make the clipboard plain text – not applicable to variables).
  • Set line endings to Mac, Unix or Windows/DOS.
  • Trim Whitespace.
  • Hard wrap or unwrap paragraphs.
  • Lowercase (all characters), Lowercase First (just the first character).
  • Uppercase (all characters), Uppercase First (just the first character).
  • Capitalize (all words) or Title Case (intelligently uppercase certain first letters).
  • Change quotes to Smart, Dumb or French quotation marks.
  • Encode HTML or non-ASCII HTML entities.
  • Decode HTML entities.
  • Generate an HTML list.
  • Percent Encode or Decode a URL.
  • Quote for AppleScript, JavaScript, Shell (bash) Script, or Swift.
  • Convert a JSON object string to Compact or Pretty format (v9.0+).
  • Get the filename component of a path.
  • Get parent of a path.
  • Get the basename of the path (ie the name without directory or extension).
  • Get or delete the path extension.
  • Get the display name of a path (v9.0+).
  • Expand tilde (~) paths, or abbreviate with a tilde.
  • Resolve symlinks, or standardize the path.
  • Delete or bullet (•) control characters.
  • Calculate an expression and return the result, see the Calculations section.
  • Process Text Tokens and return the result, see the Tokens section.
  • Get the value of a named Variable or Named Clipboard.
  • Count the characters, words or lines and return the result.

Select where the result should go - back to the source or to a clipboard, variable or file. Prior to v8.0 the result was always saved back to the source.

The list of possible filters will likely expand, so if you have specific filtering needs that you think might be of general interest, please let us know. In the mean time, remember that you can apply scripted filters using an AppleScript or shell script.

For example the Execute Shell Script action:

is roughly equivalent to the Uppercase filter, for the System Clipboard, except that it only works with ASCII characters.

Note that the definition of what a character, word, or line is is more than a little ambiguous, so if you have strict requirements for your definition you will need to calculate it yourself to ensure you get the answer you require. For example, the line count will return the number of lines, with a minimum of one, which will not necessarily be the same as the number of end-of-line characters, and the number of characters may or may not count multi-plane unicode characters as one character, and we wont even attempt to define what is and isn’t a single word.

See Also

Actions

Forum

Keywords

Change Case, Expand Path, Full Path

action/Filter.1562576101.txt.gz · Last modified: 2019/07/08 04:55 by peternlewis