Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


mklement0 last won the day on December 14 2015

mklement0 had the most liked content!

Contact Methods

  • Website URL

Recent Profile Visitors

1,059 profile views

mklement0's Achievements


Member (4/5)



  1. E.g., searching for "Dunbar's number" correctly shows the preview of the Dictionary.app article, but submitting the entry in order to display it in Dictionary.app quietly fails - a blank page is shown. Omitting the apostrophe (single quote) - searching for "Dunbar number" - works as expected.
  2. Note: This is not a workflow, but a helper CLI (command-line utility) geared toward Alfred users who manage development of multiple workflows intended for sharing. I suggest installing via the npm registry, if you have Node.js installed - if not, consider installing it just to benefit from its great package manager, npm; try curl -L http://git.io/n-install | bash ): [sudo] npm install -g awf Alternatively, here are instructions for manual installation. Note, however, that the npm-based installation makes updating to a newer version much easier. Below is a high-level overview; you can find the full manual in the repo's Usage chapter, or, once installed, you can execute awf help (concise overview), awf help all (full manual), or awf help <sub-command>. ------ awf (Alfred Workflow) is an OS X CLI for managing and assisting in the development of workflows for command-line launcher Alfred 2. It comes with a broad range of features: Note: Some features related to Alfred Preferences.app involve GUI scripting and therefore require that the application running awf - typically, Terminal.app - be granted access to accessibility features - you will be prompted for authorization on first use; for more information, see Apple’s support article on the subject. Retrieving information about workflows List all workflows or workflows matching a filter, optionally with selectable output fields.awf list -s i net.same2u. # list matching workflows by bundle ID substring Print information about a given workflow.awf info net.same2u.speak.awf Locating workflows Locate a workflow’s installation folder by its bundle ID.awf which net.same2u.speak.awf # prints installation folder path Reveal a workflow’s folder in Finder.awf reveal net.same2u.speak.awf Trigger a keyword search for workflows in Alfred Preferences.awf search speak Editing workflows Change to a workflow’s folder in Terminal.awf cd net.same2u.speak.awf # opens a tab in a new window Open a workflow in Alfred Preferences for editing.awf edit net.same2u.speak.awf awf edit # from a workflow source folder Installing and exporting workflows Install a (copy of a) workflow from a source folder.awf install . Export a *.alfredworkflow archive from a source folder.awf export . # exports to '*.alfredworkflow' in same folder by default Developing workflows Note: The purpose of the following features is to allow you to store workflows being developed in a separate location instead of directly among the installed workflows. A symlink to the dev location placed among the installed folders ensures that you can still use and develop the workflow from within Alfred and Alfred Preferences. These features move directories, create symlinks, and delete files. Care is taken not to accidentally overwrite or delete files, but use these features with caution and always create backups. Symlink a dev folder (source folder) into the folder of installed worklows or remove a dev folder’s symlink.awf link . # effective installation without moving the directory awf unlink . # remove a symlink - effective uninstallation Move an existing, regular workflow to a dev folder in a different location and replace the original workflow folder with a symlink to the dev folder.awf todev net.same2u.speak . # move to current folder and perform 'awf link' Conversely, move a dev folder back to the folder of installed workflows as a regularly installed workflow.awf fromdev . # -k keeps the source folder Manage workflow version numbers via file version.awf version patch # bumps the patch component of the workflow's version number
  3. The workflow comes with two distinct feature groups: Speak the active application's text with a specific voice; useful for multilingual setups where you want to have text spoken in one of several languages on demand. For instance, you could have one global keyboard shortcut for speaking text in English, and another one for Spanish. Speak specified text with one or more voices, selectable by name(s) or language(s); useful for interactive experimentation with multiple voices, such as to contrast regional accents. For details, see the repo. Here's the direct download link to the most recent stable version (this link will remain current). However, I suggest installing via the npm registry, if you have Node.js installed - if not, consider installing it just to benefit from its great package manager, npm; try curl -L http://git.io/n-install | bash ): [sudo] npm install -g speak.awf The advantage of this installation method is twofold: Remembering only the package name is sufficient to install the workflow (again). More importantly: It's easy to update the workflow to its latest version: [sudo] npm update -g speak.awf If the latest version is already installed, no action is performed.
  4. Below is a fairly robust AppleScript that uses tel:// to prepare a call and then presses the Call button using GUI scripting (Alfred needs to be authorized once via System Preferences > Security & Privacy > Accessibility). It's trivial to adapt it to using facetime:// or facetime-audio:// instead. In my case I've assigned it to an /usr/bin/osascript Run Script action attached to a Contact Action trigger named 'Instantly call with iPhone' in a custom workflow, and I've associated that contact action with the Phone field in Alfred Preferences > Features > Contacts > Custom Actions. (I've also created a variant for FaceTime Audio calls and assigned it to the Email field.) Thus, when I press ↩ on a contact's phone number in Alfred, an iPhone call is instantly started. (And when I press ↩ on a contact's email address, a FaceTime Audio call is instantly started.) # Open the URL, which will present the click-to-call window. # Note: Replace 'tel:' with 'facetime:' or 'facetime-audio:' for FaceTime Video / Audio do shell script "open tel:" & quoted form of "{query}" # Wait until the click-to-call window appears. # Note: # If FaceTime wasn't running, that window will be the first and only one to appear. # Otherwise, that window is presented quickly enough to be the front (and only) # window by the time we try to click the button below. my syncActivateWithWindow("FaceTime") # Click the 'Call' button to start the call. tell application "System Events" to click button "Call" of front window of application process "FaceTime" # --- # *Synchronously activates* the specified application *and waits for at least one window to open*. # I.e., when this subroutine returns, the specified app is frontmost with a window open. # Required, because on 10.10+ the activate command is *asynchronous*. # Set TMOUT to adjust the timeout after which an error is raised. # CAVEAT: Works with non-AppleScriptable apps, but assumes that the application *process* name is the same as the application name. on syncActivateWithWindow(appName) local TMOUT, elapsedSoFar set TMOUT to 5 # secs. set elapsedSoFar to 0 tell application appName activate repeat while not frontmost if elapsedSoFar > TMOUT then appName & " failed to activate within " & TMOUT & " seconds." delay 0.1 set elapsedSoFar to elapsedSoFar + 0.1 end repeat tell application "System Events" # Note: We check for windows in the "System Events" context so as to also work with non-AppleScriptable apps. tell application process appName repeat while true if elapsedSoFar > TMOUT then error "No " & appName & " window appeared within " & TMOUT & " seconds." try front window of it exit repeat end try delay 0.1 set elapsedSoFar to elapsedSoFar + 0.1 end repeat end tell end tell end tell end syncActivateWithWindow
  5. - It stopped working with the very same contacts that it used to work with? If they're different ones, there may be a problem with their formatting: try retyping the number from scratch in the contact-card field. - On your iPhone, is Settings > FaceTime > iPhone Cellular Calls still turned on? Can you still *accept* calls on your Mac?
  6. By "modal" query type I mean one created by connecting a hotkey directly to a script filter, or by calling an external trigger directly connected to a script filter. (Alfred then show's that script filter's icon (in place of Alfred's) and directs all input to that script filter - no keyword is being shown.) As an aside: is there an established/better name for this? - Currently, the typed-query history (pressing up-arrow or, if turned on, having the last query automatically redisplayed) doesn't work in such modal queries at all. - Similarly, query strings entered in a modal query do not get recorded even in the general history. It would be helpful to have a *query-type-specific* (scoped) typed-query history in that event. I.e., when you enter such a modal query again, only *that* query's history is presented. In addition or alternatively, query strings from modal query types could be included in the general history, prefixed by their script filter's keyword (if defined). ------ I realize that I could alternatively define a hotkey to simply open Alfred with a keyword, giving me regular queries that become part of the history, but I quite like the separate mode / scope that is entered for modal query types - and it does open the door for a scoped history. Example use case: I have a modal query for searching Evernote that I activate with a hotkey. Having access to past queries there - limited to queries of that type - would be handy.
  7. Great tip. Note that the // part is optional, tel:{query} will do. On a related note, facetime:{query} (audio+video) and facetime-audio:{query} (audio only) work as well. A caveat, though it may unique to my setup: among my contacts I found phone numbers with no-break spaces (Unicode 0xa0; UTF-8: 0xc2 0xa0) instead of regular spaces - these won't work.
  8. As of v2.4 (279) If a workflow name contains words in parentheses/curly braces/square brackets, searching for the word immediately following the opening parenthesis/curly brace/square bracket doesn't work in Preferences (Workflows tab). Example: Say you have a workflow with the following name: Ask Different (StackExchange site) Searching for any of these words in isolation in Preferences works, EXCEPT for "StackExchange", seemingly because it immediately follows the "(" - the same applies to "{" and "[" - possibly to others. Perhaps this is related to use of regular expressions behind the scenes? If you simply insert a space after the opening parenthesis/curly brace/square bracket, the word is found again.
  9. @chadv: Thanks for investigating and letting me know. Shame indeed, especially given that it hasn't been fixed in OS X 10.10 (the current public beta), which still ships with the same libiconv version (1.11). Curiously, 3- and 6-byte UTF8 emoji sequences as well as those 7-byte sequences that start with an ASCII char. byte (followed by combining characters) do work properly, but the majority of emoji (4-byte sequences) do not. On a side note, Terminal.app, while *rendering* emoji as expected, doesn't handle them properly in terms of cursor placement, printing the next character, and backspacing. 6-, 7-, 8-byte sequences seemingly involve combining characters, and are misinterpreted as comprising *2 or 3* characters, which has all sorts of unwanted side effects.
  10. @Andrew's normalise utility works great, but I've since found that there is an alternative using the standard utility iconv with the (somewhat obscurely named) UTF8-MAC encoding scheme: Note: The following examples use bash. iconv expects its input via a filename or stdin. Applied to the example above: # Converts NFD form of 'й' to NFC form iconv -f UTF8-MAC <<<'й' Some background: The following examples use input string 'ü' in NFC form, $'\xc3\xbc' - i.e., bytes 0xC3 0xBC, which is the UTF8 encoding of Unicode codepoint 0xFC in NFD form, $'u\xcc\x88' - i.e., a u - the base character - followed by bytes 0xCC 0x88, which is the UTF8 encoding of Unicode codepoint 0x308, the so-called combining diaeresis (¨). to demonstrate converting; note that in Terminal the result will always appear as ü - pipe to hexdump -C, for instance, to see the byte values. # NFC -> NFD iconv -t UTF8-MAC <<<$'\xc3\xbc' # -> $'u\xcc\x88' # NFD -> NFC iconv -f UTF8-MAC <<<$'u\xcc\x88' # -> $'\xc3\xbc' These conversions are safe to use in that if the input string is already in the target format, it is left as is.
  11. @Andrew: Just an FYI (given that your `normalise` CLI solved the problem): using `iconv -t ASCII/TRANSLIT` to replace accented characters with their base form, as described in the stackoverflow.com answer you linked to, does NOT work properly on OS X as of 10.9.2. For instance echo 'aüé' | iconv -f UTF8 -t ASCII//TRANSLIT yields 'a"u'e' rather than 'aue'.
  12. > That's what computers work with Not consistently: OS X has reported base-10 numbers with respect to drive capacity (in line with manufacturers' specs.) since Snow Leopard (10.6). Confusion exists, but it can be avoided by using distinct unit names for the base-10 and base-2 definitions: GB (gigabyte)= base 10 = 10 ^ 9 GiB (gibibyte [sic]) = base 2 = 2 ^ 30 (analogous distinction for KB/KiB, ...) This distinction was adopted by the IEC (International Electrotechnical Commission) and "the IEC Standard had been adopted by the IEEE, EU, and NIST." Source: https://en.wikipedia.org/wiki/Gigabyte
  13. Thanks, Vero - works great. +1 on Carlos' suggestion re 'uid' as an element, too. Carlos, I'm afraid I don't understand the Quick Look suggestion. Do you mean having Alfred show the value of 'arg' in the result list if there's no 'title' or 'subtitle' element? What other workflow tasks do you mean?
  • Create New...